Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[backup recovery] physical cold backup and recovery

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Cold backup: turn off database backup, requiring backup of three major database files (data files, control files, log files), parameter files and password files; at the same time, close the database consistently before cold backup, so as to trigger ckpt to achieve the consistency of the three major files, so that recover is not required to restore the database.

1. View the absolute path of backup files (important)

SYS@ORA11GR2 > select name from v$datafile

NAME

-- / u01/app/oracle/oradata/ORA11GR2/system01.dbf

/ u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf

/ u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf

/ u01/app/oracle/oradata/ORA11GR2/users01.dbf

/ u01/app/oracle/oradata/ORA11GR2/example01.dbf

/ u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf

/ u01/app/oracle/oradata/ORA11GR2/undotbs2_01.dbf

7 rows selected.

SYS@ORA11GR2 > select name from v$controlfile

NAME

/ u01/app/oracle/oradata/ORA11GR2/control01.ctl

/ u01/app/oracle/oradata/ORA11GR2/control02.ctl

/ u01/app/FRA/control03.ctl

SYS@ORA11GR2 >

SYS@ORA11GR2 > select member from v$logfile

MEMBER

/ u01/app/oracle/oradata/ORA11GR2/redo03.log

/ u01/app/oracle/oradata/ORA11GR2/redo02.log

/ u01/app/oracle/oradata/ORA11GR2/redo01.log

/ u01/app/oracle/oradata/ORA11GR2/redo01_a.log

/ u01/app/oracle/oradata/ORA11GR2/redo02_a.log

/ u01/app/oracle/oradata/ORA11GR2/redo03_a.log

/ u01/app/FRA/redo01_b.log

/ u01/app/FRA/redo02_b.log

/ u01/app/FRA/redo03_b.log

9 rows selected.

SYS@ORA11GR2 >

two。 Consistent shutdown of the database: (triggers CKPT and then implements backup)

SYS@ORA11GR2 > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@ORA11GR2 >

3. Go back to the operating system layer to copy the mirror (all database files)

-- create backup directory:

[oracle@wang ~] $mkdir cold

[oracle@wang ~] $ls

Cold

[oracle@wang ~] $cd cold/

[oracle@wang cold] $ls

[oracle@wang cold] $

[oracle@wang cold] $pwd

/ home/oracle/cold

-- backup control files, data files, and redo logs to the backup directory:

[oracle@wang ~] $cd / u01/app/oracle/oradata/

ORA11GR2/ PROD/

[oracle@wang ~] $cd / u01/app/oracle/oradata/

[oracle@wang oradata] $

[oracle@wang oradata] $cd ORA11GR2

[oracle@wang ORA11GR2] $ls

Control01.ctl redo02.log ts_ora11gr2_01.dbf

Control02.ctl redo03_a.log undotbs01.dbf

Example01.dbf redo03.log undotbs2_01.dbf

Redo01_a.log sysaux01.dbf users01.dbf

Redo01.log system01.dbf

Redo02_a.log temp01.dbf

[oracle@wang ORA11GR2] $pwd

/ u01/app/oracle/oradata/ORA11GR2

[oracle@wang ORA11GR2] $cp * / home/oracle/cold/

[oracle@wang ORA11GR2] $

Successful, verify:

[oracle@wang cold] $du-sh

2.3G.

[oracle@wang cold] $ll

Total 2383092

-rw-r- 1 oracle oinstall 9748480 Sep 27 15:12 control01.ctl

-rw-r- 1 oracle oinstall 9748480 Sep 27 15:12 control02.ctl

-rw-r- 1 oracle oinstall 363077632 Sep 27 15:12 example01.dbf

-rw-r- 1 oracle oinstall 52429312 Sep 27 15:12 redo01_a.log

-rw-r- 1 oracle oinstall 52429312 Sep 27 15:12 redo01.log

-rw-r- 1 oracle oinstall 52429312 Sep 27 15:12 redo02_a.log

-rw-r- 1 oracle oinstall 52429312 Sep 27 15:12 redo02.log

-rw-r- 1 oracle oinstall 52429312 Sep 27 15:12 redo03_a.log

-rw-r- 1 oracle oinstall 52429312 Sep 27 15:12 redo03.log

-rw-r- 1 oracle oinstall 660611072 Sep 27 15:12 sysaux01.dbf

-rw-r- 1 oracle oinstall 849354752 Sep 27 15:12 system01.dbf

-rw-r- 1 oracle oinstall 51388416 Sep 27 15:12 temp01.dbf

-rw-r- 1 oracle oinstall 20979712 Sep 27 15:12 ts_ora11gr2_01.dbf

-rw-r- 1 oracle oinstall 94380032 Sep 27 15:12 undotbs01.dbf

-rw-r- 1 oracle oinstall 104865792 Sep 27 15:12 undotbs2_01.dbf

-rw-r- 1 oracle oinstall 6561792 Sep 27 15:12 users01.dbf

[oracle@wang cold] $

-- back up parameter files and password files:

[oracle@wang ORA11GR2] $cd $ORACLE_HOME/dbs

[oracle@wang dbs] $cp initORA11GR2.ora spfileORA11GR2.ora / home/oracle/cold/

[oracle@wang dbs] $

[oracle@wang dbs] $cp orapwORA11GR2 / home/oracle/cold/

Verify:

[oracle@wang cold] $ls initORA11GR2.ora

InitORA11GR2.ora

[oracle@wang cold] $ls spfileORA11GR2.ora

SpfileORA11GR2.ora

[oracle@wang cold] $ls orapwORA11GR2

OrapwORA11GR2

4. Simulated deletion of parameter files and password files of $ORACLE_HOME/dbs, and deletion of all database files under $ORACLE_HOME/oradata/ORA11GR2/

[oracle@wang dbs] $cd / u01/app/oracle/oradata/ORA11GR2/

[oracle@wang ORA11GR2] $ls

Control01.ctl example01.dbf redo01.log redo02.log redo03.log system01.dbf ts_ora11gr2_01.dbf undotbs2_01.dbf

Control02.ctl redo01_a.log redo02_a.log redo03_a.log sysaux01.dbf temp01.dbf undotbs01.dbf users01.dbfv

[oracle@wang ORA11GR2] $rm *

[oracle@wang ORA11GR2] $ls

[oracle@wang ORA11GR2] $

5. Start the instance (nomount):

SYS@ORA11GR2 > startup nomount

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file'/ u01ActionAccord product 11.2.0GR2.ora'initORA11GR2.ora'

SYS@ORA11GR2 >

Show that no parameter file was found, restore the parameter file:

[oracle@wang cold] $cp initORA11GR2.ora spfileORA11GR2.ora / u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@wang cold] $

Start the instance again:

SYS@ORA11GR2 > startup nomount

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2256832 bytes

Variable Size 457179200 bytes

Database Buffers 268435456 bytes

Redo Buffers 2842624 bytes

SYS@ORA11GR2 >

-- start the instance

6. Boot to mount:

SYS@ORA11GR2 > alter database mount

Alter database mount

*

ERROR at line 1:

ORA-00205: error in identifying control file, check alert log for more info

SYS@ORA11GR2 >

Restore the control file:

[oracle@wang cold] $cp control01.ctl control02.ctl / u01/app/oracle/oradata/ORA11GR2/

[oracle@wang cold] $

[oracle@wang ORA11GR2] $pwd

/ u01/app/oracle/oradata/ORA11GR2

[oracle@wang ORA11GR2] $

[oracle@wang ORA11GR2] $ls

Control01.ctl control02.ctl

Boot to mount again:

SYS@ORA11GR2 > alter database mount

Database altered.

SYS@ORA11GR2 >

Success!

7. Open the database:

SYS@ORA11GR2 > alter database open

Alter database open

*

ERROR at line 1:

ORA-01157: cannot identify/lock data file 1-see DBWR trace file

ORA-01110: data file 1:'/ u01 *

-- restore data files and log files:

[oracle@wang cold] $cp * dbf * log / u01/app/oracle/oradata/ORA11GR2/

[oracle@wang cold] $

[oracle@wang ORA11GR2] $ls

Control01.ctl example01.dbf redo01.log redo02.log redo03.log system01.dbf ts_ora11gr2_01.dbf undotbs2_01.dbf

Control02.ctl redo01_a.log redo02_a.log redo03_a.log sysaux01.dbf temp01.dbf undotbs01.dbf users01.dbf

-- Open the database again:

SYS@ORA11GR2 > alter database open

Database altered.

SYS@ORA11GR2 > select status from v$instance

STATUS

-

OPEN

SYS@ORA11GR2 >

The database has been opened and restored successfully!

(the database has been recovered from the cold backup and does not need recovery, because the cold backup is implemented on the basis of a consistent shutdown of the database, and the database is already in a consistent state)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report