Check if the database is in archive mode, turn on the database hot standby mode, copy the operating system database data files to the backup directory
[email protected]> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/archOldest online log sequence 2Next log sequence to archive 4Current log sequence 4[email protected]> alter database begin backup;Database altered.[email protected]> host[[email protected] PROD]$ rm -rf /home/oracle/bak/*[[email protected] PROD]$ cp *.dbf /home/oracle/bak[[email protected] PROD]$ exitexit[email protected]> alter database end backup;Database altered.
Delete all data files
[email protected]> host[[email protected] PROD]$ rm -rf *.dbf[[email protected] PROD]$ lltotal 172652-rw-r----- 1 oracle oinstall 9748480 Jan 24 22:50 control01.ctl-rw-r----- 1 oracle oinstall
Start Database error
[email protected]> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.[email protected]> startupORACLE instance started.Total System Global Area 835104768 bytesFixed Size 2257840 bytesVariable Size 536874064 bytesDatabase Buffers 289406976 bytesRedo Buffers
Copy hot-prepared data files to the original data file directory
[[email protected] PROD]$ cp /home/oracle/bak/*.dbf ./ ——拷贝数据文件到以前的数据文件目录[[email protected] PROD]$ exitexit[email protected]> select open_mode from v$database;OPEN_MODE--------------------MOUNTED[email protected]> alter database open——尝试打开数据库,报错 2 ;alter database open*ERROR at line 1:ORA-01113: file 1 needs media recoveryORA-01110: data file 1: ‘/u01/app/oracle/oradata/PROD/system01.dbf‘
Recovering a Database
[email protected]> recover database;——恢复数据库Media recovery complete.[email protected]> alter database open;——开库Database altered.[email protected]> select status from v$instance;STATUS------------OPEN
Oracle 11g manual Hot Standby-database