Get the App
SLTechnology News&Howtos  ›  Database  › 

Manual hot backup

Shulou Source: shulou.com Published: 2022-06-01 16:14:15 09月10日 Update

Manual hot backup steps:

Open backup is only used in archive mode, and before hot backup, execute the command:

Hot standby steps:

alter database/tablespace XXX begin backup This sentence causes the lock block header to change, and the scn sign does not change.

cp files

alter database/tablespace XXX end backup

Experiment with backing up users tablespaces and testing deleted files and restores:

First, start backing up the users table space.

sys@TEST0910> alter tablespace users begin backup;

Tablespace altered.

2, the operating system command copy file:

[oracle@rtest ~]$ cd /u01/app/oracle

[oracle@rtest oracle]$ mkdir hot_dir

[oracle@rtest oracle]$ cp /u01/app/oracle/oradata/test0910/users01.dbf /u01/app/oracle/hot_dir/users01.dbf

3. End the backup of the users table space:

sys@TEST0910> alter tablespace users end backup;

Tablespace altered.

4. Delete users01.dbf file at this time

[oracle@rtest oracle]$ ls /u01/app/oracle/oradata/test0910/users01.dbf

ls: /u01/app/oracle/oradata/test0910/users01.dbf: No such file or directory

5. Close the library, reopen the library, and report an error:

sys@TEST0910> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

sys@TEST0910> startup

ORACLE instance started.

Total System Global Area 2505338880 bytes

Fixed Size 2230952 bytes

Variable Size 587203928 bytes

Database Buffers 1895825408 bytes

Redo Buffers 20078592 bytes

Database mounted.

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

ORA-01110: data file 4: '/u01/app/oracle/oradata/test0910/users01.dbf'

6, copy to the correct location through the operating system,(can also be restored through rman, here in copy mode)

[oracle@rtest oracle]$ cp /u01/app/oracle/hot_dir/users01.dbf /u01/app/oracle/oradata/test0910/users01.dbf

[oracle@rtest oracle]$ ls /u01/app/oracle/oradata/test0910/users01.dbf

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

7. Open the library again, report error, need media recovery:

sys@TEST0910> alter database open;

alter database open

*

ERROR at line 1:

ORA-01113: file 4 needs media recovery

ORA-01110: data file 4: '/u01/app/oracle/oradata/test0910/users01.dbf'

8. Media recovery:

sys@TEST0910> recover datafile 4;

Media recovery complete.

9. Re-open the library. Success:

sys@TEST0910> alter database open;

Database altered.

Tags: Backup copy file space open library operating system media command step system manual success location can be passed block way mode this sentence before change Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Technology Shulou Tech Info MariaDB MySQL