Home Database Mysql Tutorial Oracle DB 使用RMAN将数据库移植到ASM存储区

Oracle DB 使用RMAN将数据库移植到ASM存储区

Jun 07, 2016 pm 05:33 PM

由于ASM 文件无法通过正常的操作系统界面访问,因此RMAN 是复制ASM 文件的唯一途径。虽然由于表空间的历史原因,表空间中的文件既

1. 完全关闭数据库。

2. 关闭数据库并修改服务器参数文件,以使用Oracle Managed Files (OMF)。

3. 编辑并执行以下RMAN 脚本:

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";

 

 

  • 将数据库移植到ASM 存储区
  • 由于ASM 文件无法通过正常的操作系统界面访问,因此RMAN 是复制ASM 文件的唯一途径。虽然由于表空间的历史原因,表空间中的文件既可以是ASM 文件,也可以是非ASM 文件,但是RMAN 命令会将非ASM 文件移到ASM 磁盘组中。通过以下过程,可以将整个数据库移到ASM 磁盘组中:(假定你使用的是服务器参数文件。)

    1. 使用V$CONTROLFILE和V$LOGFILE,获取当前控制文件和联机重做日志的文件名。

    2. 像平常一样关闭数据库。按如下所述,修改数据库的服务器参数文件:

    - 将必要的OMF 目标参数设置为所需的ASM 磁盘组。

    - 删除CONTROL_FILES参数。

    3. 编辑和运行RMAN 命令文件,这将备份数据库、将当前数据文件移到备份中并重命名联机重做日志。使用BACKUP AS COPY命令只能移动表空间或数据文件。

    4. 删除旧的数据库文件。

    注:如果创建一个OMF 控制文件,,并且有一个服务器参数文件,则会在该服务器参数文件中创建一个CONTROL_FILES初始化参数条目。

     

     

  • 将表空间移植到ASM 存储中
  • 移植表空间,使其可以使用ASM 存储。

    1. 使用SQL*Plus,以 SYSDBA 用户身份连接到数据库实例,然后创建一个名为TBSASMMIG 的新的表空间。此表空间应当只包含一个存储于文件系统中的10 MB

    大小的文件(不使用ASM)。请确保连接的是 test0924(我本机的测试实例)实例,而不是ASM 实例。

    2. 创建一个名为 T2、存储在新的表空间 TBSASMMIG 中的表。在 T2 中插入一行。 提交你所做的操作。

    3. 将 TBSASMMIG 移植到ASM 存储中。完成操作后,请检查移植是否成功,并且该表空间中的表是否保持原样。

    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/tbsasmmig01.dbf' size 10m;

    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/tbsasmmig01.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, 2011, 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/tbsasmmig01.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

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

    InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

    How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

    The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

    When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

    Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

    Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

    Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

    Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

    The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

    What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

    Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

    How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

    Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

    How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

    The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

    See all articles