search
HomeDatabaseMysql TutorialOracle DB 使用RMAN将数据库移植到ASM存储区

由于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
    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
    MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

    MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

    MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

    MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

    MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

    MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

    The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

    SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

    MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

    The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

    MySQL's Role: Databases in Web ApplicationsMySQL's Role: Databases in Web ApplicationsApr 17, 2025 am 12:23 AM

    The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

    MySQL: Building Your First DatabaseMySQL: Building Your First DatabaseApr 17, 2025 am 12:22 AM

    The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

    MySQL: A Beginner-Friendly Approach to Data StorageMySQL: A Beginner-Friendly Approach to Data StorageApr 17, 2025 am 12:21 AM

    MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.

    See all articles

    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 Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    1 months agoBy尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    1 months agoBy尊渡假赌尊渡假赌尊渡假赌
    Will R.E.P.O. Have Crossplay?
    1 months agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    MinGW - Minimalist GNU for Windows

    MinGW - Minimalist GNU for Windows

    This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

    SublimeText3 English version

    SublimeText3 English version

    Recommended: Win version, supports code prompts!

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    SAP NetWeaver Server Adapter for Eclipse

    SAP NetWeaver Server Adapter for Eclipse

    Integrate Eclipse with SAP NetWeaver application server.

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool