I. experiment environment
Db_A: 192.168.0.3 db_ B: 192.168.0.4
Db_A is the production database, and db_ B is the backup database (not running). the environments of the two databases are identical.
Ii. Operations
1. db_A operations
Grade 0 rman backup on db_A
$ Rman target/
RMAN> backup incremental level = 0 database format = '/oradata/back/% U ';
Add a scheduled task and execute the following script:
---------------------------------------------------------------------
Db_rsync.sh
#! /Bin/sh
# Keep tow db Synchronous
ORACLE_HOME =/oracle/app/oracle/product/10.2.0/db_1
Bak_dir =/oradata/back
Archive_dir =/oradata/arch
Dest_db = oracle@192.168.0.4
Passwd = ufsoft
Ls-l $ bak_dir | awk '{print $ NF}' | sed '1d '> list1
Ls-l $ archive_dir | awk '{print $ NF}' | sed '1d '> list2
Rsync_exec1 (){
CT-c"
Set timeout 7200;
Spawn rsync-rpogtv -- files-from = list1 $ bak_dir $ dest_db: $ bak_dir
CT {
\ "* Yes/no * \" {send \ "yes \ r \"; exp_continue}
\ "* Password * \" {send \ "$ passwd \ r \";}
}
CT eof ;"
Rsync_exec2 (){
CT-c"
Set timeout 7200;
Spawn rsync-rpogtv -- files-from = list2 $ archive_dir $ dest_db: $ archive_dir
CT {
\ "* Password * \" {send \ "$ passwd \ r \";}
}
CT eof ;"
}
Rsync_exec1
Rsync_exec2
Rm-f list1 list2
---------------------------------------------------------------------
2. db_ B operations
$ Echo "db_name = ora10g"> $ ORACLE_HOME/dbs/initora10g. ora
$ Sqlplus/as sysdba
SQL> startup nomount
$ Ls/oradata/back # view the backup files uploaded from db_A. The smaller one is the backup of parameter files and control files, and the largest one is the backup of data files. You can run "RMAN> list backup;" on db_A to view the information.
0fmhsg4r 0gmhsg5k
$ Rman target/
RMAN> restore spfile from '/oradata/back/0gmhsg5k ';
RMAN> startup nomount force;
RMAN> restore controlfile from '/oradata/back/0gmhsg5k ';
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database; # An error will be reported, but it doesn't matter. We only need to get the thread and sequence numbers.
Starting recover at 20-JUL-11
Using channel ORA_DISK_1
Starting media recovery
Unable to find archive log
Archive log thread = 1 sequence = 1
RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of recover command at 01:33:58
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 484679
RMAN> run {
2> set until sequence 1 thread 1;
3> recover database;
4>}
RMAN> alter database open resetlogs;
Now the database is running properly.
RMAN> delete noprompt backup;
RMAN> backup incremental level = 0 database format = '/oradata/back/% U ';
This experiment is designed to achieve disaster recovery without using dateguard.
Note: If you log on to a PL/SQL Server using sys, the system prompts that the permission is insufficient.
This article is from the "from cisco to linux" blog