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

Detailed explanation of Oracle cold backup [actual combat case]

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Detailed explanation of Oracle cold backup

-- preparation work

Select * from v$database

Select file_name from dba_data_files

Create tablespace inv datafile'/ oradata/ocm/inv01.dbf' size 2048m

Create user inv identified by inv default tablespace inv temporary tablespace temp

Grant dba,resource to inv

Alter user scott account unlock

SQL > conn scott/tiger

Select * from tab

Select 'create table' | | tname | |'as select * from scott.' | | tname | |'; 'from tab

Create table BONUS as select * from scott.BONUS

Create table DEPT as select * from scott.DEPT

Create table EMP as select * from scott.EMP

Create table SALGRADE as select * from scott.SALGRADE

Create table te_objects as select * from dba_objects

-- oracle cold backup

Select instance_name,version,status,archiver,database_status from v$instance

Select dbid,name,log_mode from v$database

-- the files that need to be backed up include:

/ *

Data files, online redo log files, control files, temporary files, parameter files, password files, monitoring files, tnsnames files, sqlnet files

, /

-- execute statement preparation

Select'cp'| | name | |'/ ggs/backup/cold_back' from v$datafile

Union all

Select'cp'| | name | |'/ ggs/backup/cold_back' from v$tempfile

Union all

Select'cp'| | member | |'/ ggs/backup/cold_back' from v$logfile

Union all

Select'cp'| | name | |'/ ggs/backup/cold_back' from v$controlfile

-- Note: use the Linux command generated by the above SQL to execute, as follows:

Cp / oradata/ocm/system01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/sysaux01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/undotbs01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/users01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/ogg.dbf / ggs/backup/cold_back

Cp / oradata/ocm/inv01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/temp01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/redo04a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo04b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo03a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo03b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo02a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo02b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo01a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo01b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/control01.ctl / ggs/backup/cold_back

Cp / oradata/ocm/control02.ctl / ggs/backup/cold_back

Cp / oradata/ocm/control03.ctl / ggs/backup/cold_back

Create pfile='/ggs/backup/cold_back/dbs/initocm.ora' from spfile

Cp $ORACLE_HOME/dbs/orapwocm / ggs/backup/cold_back/dbs/

Cp $ORACLE_HOME/network/admin/ / ggs/backup/cold_back/admin/

-- close the database

Alter system archive log all

Shutdown immediate

-- execute code

Cp / oradata/ocm/system01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/sysaux01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/undotbs01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/users01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/ogg.dbf / ggs/backup/cold_back

Cp / oradata/ocm/inv01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/temp01.dbf / ggs/backup/cold_back

Cp / oradata/ocm/redo04a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo04b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo03a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo03b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo02a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo02b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo01a.rdo / ggs/backup/cold_back

Cp / oradata/ocm/redo01b.rdo / ggs/backup/cold_back

Cp / oradata/ocm/control01.ctl / ggs/backup/cold_back

Cp / oradata/ocm/control02.ctl / ggs/backup/cold_back

Cp / oradata/ocm/control03.ctl / ggs/backup/cold_back

Cp $ORACLE_HOME/dbs/orapwocm / ggs/backup/cold_back/dbs/

Cp-r $ORACLE_HOME/network/admin/ / ggs/backup/cold_back/

-- start the database

Sqlplus / as sysdba

Startup

[advantages and disadvantages of cold backup]

01. The concept of cold backup mode is easy to understand, and it is relatively simple to copy the files that need to be backed up to a safe location. Without too much intervention, it is easy to recover to a certain point in time (just copy the file back). It can be combined with the archiving method to restore the "latest state" of the database.

02, defect backup, the database must be in a consistent closed state can only provide a certain point in time to restore backup speed is relatively slow, especially the large amount of data performance impact is relatively large can not achieve table-based and user-level data recovery.

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