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
    Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

    This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

    How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

    This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

    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.

    Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

    This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

    What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

    This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

    Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

    This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

    How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

    Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

    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]

    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)
    2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    Repo: How To Revive Teammates
    4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Dreamweaver Mac version

    Dreamweaver Mac version

    Visual web development tools

    Safe Exam Browser

    Safe Exam Browser

    Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    SAP NetWeaver Server Adapter for Eclipse

    SAP NetWeaver Server Adapter for Eclipse

    Integrate Eclipse with SAP NetWeaver application server.

    SublimeText3 English version

    SublimeText3 English version

    Recommended: Win version, supports code prompts!