First, cold backup
1, cold backup occurs when the database has been shut down normally, before making a cold backup, you usually need to know the name of the backup file and the path
Copy Code code as follows:
Sql>select name from V$datefile;
Sql>select name from V$controlfile;
Sql>select member from V$logfile;
2, cold backup of the files required to be backed up include the following:
All data files, all control files, all online redo LOG files
3, the cold backup steps
① gracefully Close the instance you want to back up (instance)
② Copy all important files to the backup directory
③ start the database after the backup completes
4, with cold backup for database recovery
No Archive mode: Copies the backup file back to the original directory, and then starts the database.
Archive mode:
① copy data files, control files back to the original directory
②sql>startup Mount;
Sql>recover database using Backup controlfile;
③ Drag the appropriate archive and online logs to the CMD Command window for running logs.
④sql>alter database open resetlogs;
Second, the different machine restores
Cold Backup Recovery method
A, do not create an instance: (The database name on the source machine is ORCL)
① the Oradata directory on the target computer to establish the ORCL folder, copy the source of all the data files and online redo files to this directory.
② set up the Orcl folder in the Admin directory on the target machine, and then create the Adump, Bdump, Cdump, Udump, Dpdump, pfile six folders in ORCL.
③ the source computer's password file to the target machine's database directory.
④ Use the Oradim command under CMD oradim-new-sid ORCL to establish a service, SID for Orcl (best name and source computer backup database name consistent, do not need to rebuild password file)
⑤ copy source machine pfile to a directory of the target machine, modify the Pfile file path, and then Sql>create spfile from pfile= ' file path ' to create the parameter file.
⑥ Rebuild Control File command: Sql>alter database backup Controlfile to trace, then generate a trace file under the Udump folder, open the file to find the following paragraph, copy to the text, modify the path and save as: Createctl.sql file (SQL script file), copied to the target machine.
Note: Sql>alter database backup Controlfile to trace as ' Aa.txt '; Linux system will be built in the DBS directory
Copy Code code as follows:
STARTUP Nomount
CREATE controlfile Reuse DATABASE "ORCL" Resetlogs Archivelog
Maxlogfiles 16
Maxlogmembers 3
Maxdatafiles 100
Maxinstances 8
Maxloghistory 292
LOGFILE
GROUP 1 ' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01. LOG ' SIZE 50M,
GROUP 2 ' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02. LOG ' SIZE 50M,
GROUP 3 ' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03. LOG ' SIZE 50M
--STANDBY LOGFILE
DataFile
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01. DBF ',
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01. DBF ',
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01. DBF ',
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01. DBF ',
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\BANK_DATA02. DBF '
CHARACTER SET ZHS16GBK;
⑦c:\>set ORACLE_SID=ORCL
C:\>sqlplus "/as sysdba"
Sql>create spfile from pfile= ' c:\pfile.txt ';
sql>@c:\createctl.sql;
Sql>shutdown immediate;
sql>startup;
Sql>alter database open resetlogs;
⑧ Add the following fragment to the Tnsnames.ora under Network\admin
ORCL =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521))
)
(Connect_data =
(service_name = ORCL)
)
)
⑨ new listener with NET configuration for ORCL instance
B, creating an instance (instance SID is consistent with the source database SID)
① Delete all files under ORADATA\ORCL of the target machine, copy all data files and redo files from the source machine to this directory
② Delete the target machine password file, copy source computer password files to the target machine.
③ the control file of the target machine on the source machine: Sql>alter database backup Controlfile to trace, then create a trace file under the Udump folder, open the file to find the above paragraph, and copy it into the text. Modify the path and then save as: Createctl.sql file (SQL script file), copied to the target machine.
④
Copy Code code as follows:
C:\>sqlplus "/as sysdba"
sql>@c:\createctl.sql;
Sql>shutdown immediate;
sql>startup;
Sql>alter database open resetlogs;
⑤ Add the following fragment to the Tnsnames.ora under Network\admin
Copy Code code as follows:
ORCL =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521))
)
(Connect_data =
(service_name = ORCL)
)
)
⑥ new listener with NET configuration for ORCL instance