Catalog
1. Environment deployment 2
1. 1. Modify the database to archive mode. 2
1. 2 create test table 2
2. Backup preparation 2
2. 1 full database backup 2
2. 2 copy parameter file 2
2. 2. 1 view parameter file path 2
2. 2.2 copy parameter file 3
2. 2.4 creating dynamic files 3
2. 5 copying archives 3
2. 5. 1 view the archive file path 3
2. 5.2 copying archives 3
2. 5.3 copy all backup files 3
3. Perform backup 4
3. 1 2recovery control file 4
3. 2 3recover data files 4
4. Full synchronization 4
4. 1 2simulation modification Data4
4. 2 3switch logs, generate new archives, and copy 4
4. 3 incomplete recovery 5
1. Environment deployment
1. 1 modify database to archive mode
SYS@sao>archive log list
Both libraries need to see
Skip the following steps for archive mode
SYS@sao>shutdown immediate; SYS@sao>startup mount; SYS@sao>alter database archivelog; SYS@sao> archive log list Database log mode Archive Mode SYS@sao>alter database open;
1. 2 create test table
SYS@sao>conn scott/tiger SCOTT@sao>create table test3 as select * from dept; SCOTT@sao>exit
2. Backup preparation
2. 1 full database backup
Create directories for backup
[oracle@oracleA1 ~]$ mkdir saodata [oracle@oracleB1 ~]$ mkdir saodata [oracle@oracleA1 ~]$ rman target /
Backup data files
RMAN> backup database format '/home/oracle/saodata/data_%U.dbf';
Backup control file
RMAN> backup current controlfile format '/home/oracle/saodata/control_%f.dbf'; RMAN> exit
Note the path to the generated file
2. 2 copy parameter file
2. 2. 1 view parameter file path
[oracle@oracleA1 ~]$ sqlplus / as sysdba
SYS@sao>show parameter spfile
create pfile from spfile;
2. 2. 2 copy parameter file
[oracle@oracleB1 ~]$ mkdir -p /u01/app/oracle/dbs [oracle@oracleA1 ~]$ scp /u01/app/oracle/dbs/initsao.ora 172.16.100.16:/u01/app/oracle/dbs/
2. 2, 3 view the B1 static parameter file and create the required directory
[oracle@oracleB1 ~]$ cat /u01/app/oracle/dbs/initsao.ora [oracle@oracleB1 ~]$ mkdir -p /u01/app/admin/sao/adump /u01/app/oradata/sao /u01/app/fast_recovery_area/sao [oracle@oracleA1 ~]$ sqlplus / as sysdba SYS@sao>select name from v$datafile; SYS@sao>exit [oracle@oracleB1 ~]$ mkdir -p /u01/app/oradata/sao
2. 2.4 creating dynamic files
[oracle@oracleB1 ~]$ sqlplus / as sysdba SYS@sao>shu abort
Creating dynamic files from static files
SYS@sao>create spfile from pfile; SYS@sao>startup nomount
2. 5 copy Archive
2. 5. 1 view the archive file path
[oracle@oracleA1 ~]$ sqlplus / as sysdba SYS@sao>select name from v$archived_log order by 1;
2. 5.2 copying archive files
[oracle@oracleB1 ~]$ rm -rf /u01/app/fast_recovery_area/SAO/archivelog/* [oracle@oracleB1 ~]$ mkdir -p /u01/app/fast_recovery_area/SAO/archivelog/ [oracle@oracleA1 ~]$ scp -r /u01/app/fast_recovery_area/SAO/archivelog/* 172.16.100.16:/u01/app/fast_recovery_area/SAO/archivelog/
2. 5.3 copy all backup files
[oracle@oracleA1 ~]$ scp saodata/* 172.16.100.16:/home/oracle/saodata/
3. Perform backup
3. 1 restore control file
[oracle@oracleB1 ~]$ ll -h saodata/ [oracle@oracleB1 ~]$ rman target / RMAN> restore controlfile from '/home/oracle/saodata/control_0.dbf';
3. 2 recover data file
RMAN> sql 'alter database mount'; RMAN> restore database; RMAN> recover database; RMAN> exit
4. Full synchronization
4. 1 Simulation modification data
[oracle@oracleA1 ~]$ sqlplus scott/tiger SCOTT@sao>select * from tab; SCOTT@sao>create table test4 as select * from dept; SCOTT@sao>create table test5 as select * from dept; SCOTT@sao>commit; SCOTT@sao>conn / as sysdba SYS@sao>select current_scn from v$database;
4. 2 switch logs, generate new archives and copy
SYS@sao>shu immediate SYS@sao>startup SYS@sao>alter system switch logfile; SYS@sao>select name from v$archived_log order by 1; SYS@sao>exit [oracle@oracleA1 ~]$ scp /u01/app/fast_recovery_area/SAO/archivelog/2019_07_01/* 172.16.100.16:/u01/app/fast_recovery_area/SAO/archivelog/2019_07_01
4. 3 incomplete recovery
[oracle@oracleB1 ~]$ sqlplus / as sysdba SYS@sao>select status from v$instance; Check the instance status, and shut down if it is not in mount status SYS@sao>shutdown immediate; SYS@sao>startup mount
Restore to the specified scn through the control file
SYS@sao>recover database using backup controlfile until change 1139151;
Reset logs command must be used for startup
SYS@sao>alter database open RESETLOGS; SYS@sao>select status from v$instance; STATUS ------------ OPEN
Validate tables created before
SYS@sao>conn scott/tiger; Connected. SCOTT@sao>select * from tab;