Oracle cold backup and recovery-recovery from backup on different machines

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.