I. Mark data
Log On with the scott user and set the tag data
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
DEPT
EMP
BONUS
SALGRADE
EMP_BAK
Creates a backup table emp_bak for the emp table.
Ii. Back up the database
1. Close the database cleanly.
SQL> shutdownimmediate
Databaseclosed.
Databasedismounted.
Oracle instance shut down.
2. Package backup data
[Oracle @ study oracle] $ tar-zcvf admin.tar.gz admin /&
[Oracle @ study oracle] $ tar-zcvf oradata.tar.gz oradata /&
[Oracle @ study db_1] $ tar-zcvf dbs.tar.gz dbs /&
3. Record the installation directory
[Oracle @ studyoracle] $ pwd
/U01/app/oracle
4. Save the backup tar package.
Iii. Recovery
1. Install database software
2. Create a database with the same name
3. database recovery
Before the database is restored, start the database and log on with scott.
SQL> startup
ORACLEinstance started.
TotalSystem Global Area 285212672 bytes
FixedSize 1267068 bytes
VariableSize 92277380 bytes
DatabaseBuffers 188743680 bytes
RedoBuffers 2924544 bytes
Databasemounted.
Databaseopened.
SQL>
SQL> conn scott/scott
ERROR:
ORA-28000: the account is locked
Warning: You are no longer connected to ORACLE.
Scott users cannot log on normally because the newly installed database does not unlock scott users. Close the database cleanly.
SQL> shutdown immediate
Databaseclosed.
Databasedismounted.
ORACLE instance shut down.
Database recovery
Decompress the backup package data to the relevant Directory, which involves three folders: oradata, admin, and dbs.
[Oracle @ study oracle] $ mv oradata/oradata_bak/
[Oracle @ study oracle] $ cp/home/oracle/oradata.tar.gz ./
[Oracle @ study oracle] $ tar-zxvf oradata.tar.gz &
[Oracle @ study oracle] $ mv admin/admin_bak/
[Oracle @ study oracle] $ cp/home/oracle/admin.tar.gz ./
[Oracle @ study oracle] $ tar-zxvf admin.tar.gz &
After replying, start the database. The database can be started normally, and scott users can log on normally, and can view tag data normally.
SQL> conn/as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1267068 bytes
Variable Size 92277380 bytes
Database Buffers 188743680 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
SQL> conn scott/scott
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
DEPT
EMP
BONUS
SALGRADE
EMP_BAK
Iv. Summary
Cold backup is the simplest backup method, but it is also the fastest recovery method. During work, cold backup will also happen. Here is a simple test.