OracleDB uses RMAN to port the database to the ASM storage Zone

Source: Internet
Author: User
Because the ASM file cannot be accessed through the normal operating system interface, RMAN is the only way to copy the ASM file. Although, due to the history of the tablespace

Because the ASM file cannot be accessed through the normal operating system interface, RMAN is the only way to copy the ASM file. Although, due to the history of the tablespace

1. Close the database completely.

2. Close the database and modify the server parameter file to use Oracle Managed Files (OMF ).

3. Edit and execute the following RMAN script:

Startup nomount;

Restore controlfile from '/u1/c1.ctl ';

Alter database mount;

Backup as copy database format' + dgroup1 ';

Switch database to copy;

SQL "ALTER DATABASE RENAME '/u1/log1' TO '+ dgroup1 '";

# Repeat RENAME command for all online redo log members

...

Alter database open resetlogs;

SQL "ALTER DATABASE TEMPFILE '/u1/temp1' DROP ";

  • Port the database to the ASM Storage Area
  • Because the ASM file cannot be accessed through the normal operating system interface, RMAN is the only way to copy the ASM file. Although the tablespace file can be either an ASM file or a non-ASM file due to the history of the tablespace, The RMAN command will move the non-ASM file to the ASM disk group. You can move the entire database to the ASM disk through the following process: (assume that you are using a server parameter file .)

    1. Use V $ CONTROLFILE and V $ LOGFILE to get the file name of the current control file and online redo log.

    2. Close the database as usual. Modify the server parameter file of the database as follows:

    -Set necessary OMF target parameters to the required ASM disk group.

    -Delete the CONTROL_FILES parameter.

    3. Edit and run the RMAN command file to back up the database, move the current data file to the backup, and rename the online redo log. The backup as copy command can only move tablespaces or data files.

    4. Delete the old database file.

    Note: If you create an OMF control file and a server parameter file, a CONTROL_FILES initialization parameter entry will be created in this server parameter file.

  • Port the tablespace to the ASM storage.
  • Port the tablespace so that it can be stored using ASM.

    1. Use SQL * Plus to connect to the database instance as SYSDBA, and create a new tablespace named TBSASMMIG. This tablespace should contain only one 10 MB stored in the file system

    (ASM is not used ). Make sure that you are connected to the test0924 instance instead of the ASM instance.

    2. Create a table named T2 stored in the new tablespace TBSASMMIG. Insert a row in T2. Submit your operations.

    3. Port TBSASMMIG to the ASM storage. After the operation, check whether the transplantation is successful and whether the tables in the tablespace are unchanged.

    Sys @ TEST0924> select FILE_NAME, TABLESPACE_NAME from dba_data_files;

    FILE_NAME TABLESPACE_NAME
    --------------------------------------------------------------------------------
    /U01/app/oracle/oradata/test0924/users01.dbf USERS
    /U01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
    /U01/app/oracle/oradata/test0924/system01.dbf SYSTEM
    /U01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
    /U01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1

    Sys @ TEST0924> create tablespace TBSASMMIG datafile '/u01/app/oracle/oradata/test0924/tbsasmmi1_1.dbf' size 10 m;

    Tablespace created.

    Sys @ TEST0924> create table t2 (id number, name varchar2 (20) tablespace TBSASMMIG;

    Table created.

    Sys @ TEST0924> insert into t2 values (1, 'a1 ');

    1 row created.

    Sys @ TEST0924> commit;

    Commit complete.

    Sys @ TEST0924> select file_id, file_name, tablespace_name from dba_data_files;

    FILE_ID FILE_NAME TABLESPACE_NAME
    ------------------------------------------------------------------------------------------
    4/u01/app/oracle/oradata/test0924/users01.dbf USERS
    3/u01/app/oracle/oradata/test0924/tbsasmmi1_1.dbf TBSASMMIG
    2/u01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
    1/u01/app/oracle/oradata/test0924/system01.dbf SYSTEM
    5/u01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
    9/u01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1

    6 rows selected.

    [Oracle @ rtest ~] $ Rman target/

    Recovery Manager: Release 11.2.0.3.0-Production on Sun Nov 3 17:02:51 2013

    Copyright (c) 1982,201 1, Oracle and/or its affiliates. All rights reserved.

    Connected to target database: TEST0924 (DBID = 2720875862)

    RMAN> SQL 'alter database datafile 3 offline ';

    SQL statement: alter database datafile 3 offline

    RMAN> backup as copy datafile 3 format '+ data ';

    Starting backup at 03-NOV-13
    Allocated channel: ORA_DISK_1
    Channel ORA_DISK_1: SID = 127 device type = DISK
    Allocated channel: ORA_DISK_2
    Channel ORA_DISK_2: SID = 191 device type = DISK
    Allocated channel: ORA_DISK_3
    Channel ORA_DISK_3: SID = 157 device type = DISK
    Channel ORA_DISK_1: starting datafile copy
    Input datafile file number = 00003 name =/u01/app/oracle/oradata/test0924/tbsasmmi1_1.dbf
    Output file name = + DATA/test0924/datafile/tbsasmmig.264.830538365 tag = TAG20131103T170603 RECID = 13 STAMP = 830538366
    Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
    Finished backup at 03-NOV-13

    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.