Create an experiment with the same name database in a remote environment using RMAN

Source: Internet
Author: User
Tags name database

As the version continues to increase, the role of RMAN as a standard backup tool is constantly enhanced. From the traditional backup and restoration tools in the past to the new environment migration and building of DG, we can see the enhancement of the RMAN tool.

This document uses RMAN as a tool to create a database with the same service name on the new host using RMAN backup. Due to the limited environment, the method used by the author is: first obtain the backup, then delete the original database, and then use the backup to re-build (including parameter, control file and data file recovery ).

Recommended reading:

RMAN: Configure an archive log deletion policy

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

1. Environment Introduction

We chose 10.2.0.1 in Linux for the experiment.

SQL> select * from v $ version;

BANNER

---------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Prod

PL/SQL Release 10.2.0.1.0-Production

CORE 10.2.0.1.0 Production

TNS for Linux: Version 10.2.0.1.0-Production

NLSRTL Version 10.2.0.1.0-Production

Currently in archive mode.

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 2

Next log sequence to archive 4

Current log sequence 4

2. Backup acquisition

RMAN supports online and offline backup modes. If you select the online backup mode, Oracle does not need to be shut down due to the backup operation, but the recovery process must be used with the apply process of the redo log. If you select the offline backup mode, Oracle needs to shut down during the backup process, but in theory archive redo log is not required.

If Oracle runs in archived mode, RMAN can perform online and offline modes. For noarchived mode, RMAN can only be backed up in offline mode.

Current environment variable:

[Oracle @ SimpleLinuxUp ~] $ Env | grep ORA

ORACLE_SID = oratest

ORACLE_BASE =/u01/app/oracle

ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1

I keep both online and offline backups. First, create the resident directory:

[Root @ SimpleLinuxUp ~] # Cd/

[Root @ SimpleLinuxUp/] # mkdir onlinebk

[Root @ SimpleLinuxUp/] # mkdir oflinebk

[Root @ SimpleLinuxUp/] # chown oracle: oinstall onlinebk/

[Root @ SimpleLinuxUp/] # chown oracle: oinstall oflinebk/

[Root @ SimpleLinuxUp/] # ls-l | grep linebk

Drwxr-xr-x 2 oracle oinstall 4096 Mar 3 oflinebk

Drwxr-xr-x 2 oracle oinstall 4096 Mar 3 onlinebk

If online backup is performed, the database does not need to be closed. The backup scope is parameter file, data file, and control file.

(Online backup)

RMAN> connect target/

Connected to target database: ORATEST (DBID = 3370560176)

Using target database control file instead of recovery catalog

RMAN> backup database format'/onlinebk/% U'; -- database

Starting backup at 03-MAR-14

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting full datafile backupset

(Space reasons, omitted ......)

Piece handle =/onlinebk/04p28ubo_1_1 tag = TAG20140303T165227 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 03-MAR-14

RMAN> backup archivelog all format'/onlinebk/% U'; -- archived logs

Starting backup at 03-MAR-14

Current log archived

Using channel ORA_DISK_1

(Space reasons, omitted ......)

Piece handle =/onlinebk/05p28uds_1_1 tag = TAG20140303T165420 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 03-MAR-14

RMAN> backup current controlfile format '/onlinebk/control. bks ';

Starting backup at 03-MAR-14

Using channel ORA_DISK_1

(Space reasons, omitted ......)

Piece handle =/onlinebk/control. bks tag = TAG20140303T165457 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 03-MAR-14

RMAN> backup spfile format '/onlinebk/spfile. bks ';

Starting backup at 03-MAR-14

Using channel ORA_DISK_1

(Space reasons, omitted ......)

Piece handle =/onlinebk/spfile. bks tag = TAG20140303T165518 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 03-MAR-14

If offline backup is performed, you need to close the database completely (not abort ). You do not need to back up archive files.

RMAN> shutdown immediate;

Database closed

Database dismounted

Oracle instance shut down

RMAN> startup mount;

Connected to target database (not started)

Oracle instance started

Database mounted

.

RMAN> backup database format '/oflinebk/% U ';

Starting backup at 03-MAR-14

Allocated channel: ORA_DISK_1

(Space reasons, omitted ......)

Piece handle =/oflinebk/09p28ukd_1_1 tag = TAG20140303T165713 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 03-MAR-14

RMAN> backup current controlfile format '/oflinebk/control. bks ';

Starting backup at 03-MAR-14

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting full datafile backupset

(Space reasons, omitted ......)

Piece handle =/oflinebk/control. bks tag = TAG20140303T165824 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 03-MAR-14

RMAN> backup spfile format '/oflinebk/spfile. bks ';

Starting backup at 03-MAR-14

Using channel ORA_DISK_1

(Space reasons, omitted ......)

Piece handle =/oflinebk/spfile. bks tag = TAG20140303T165841 comment = NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 03-MAR-14

Necessary backup elements are already available. Note: If you want to back up the TNS network parameters in three files: tnsnames. ora, listener. ora, and sqlnet. ora.

3. delete a database

Configure the XWindows tool to call dbca to delete the original database.

[Oracle @ SimpleLinuxUp oflinebk] $ export DISPLAY = 192.168.0.1: 0.0

[Oracle @ SimpleLinuxUp oflinebk] $ xclock

Warning: Missing charsets in String to FontSet conversion

Call dbca to delete the database.

Confirm database deletion.

SQL> conn/as sysdba

Connected to an idle instance.

SQL> startup

ORA-01078: failure in processing system parameters

LRM-00109: cocould not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initoratest. ora'

Note: After you use dbca to delete a database, most of the database directories created based on the OFA principle are deleted. Related Files are also deleted.

The recovery process is as follows.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.