`
helloyesyes
  • 浏览: 1326740 次
  • 性别: Icon_minigender_2
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

How to duplicate a controlfile when ASM is involved

阅读更多

This document presents different options to duplicate a controlfile in environments using ASM. The procedure applies either to duplicate a controlfile into ASM using a controlfile stored in file system or to duplicate a controlfile into ASM using a controlfile already stored in ASM.

Case One:

Duplicating a controlfile into ASM when original controlfile is stored on a file system

On the database instance:

1. Identify the location of the current controlfile:
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/oradata2/102b/oradata/P10R2/control01.ctl'

2. Shutdown the database and start the instance:
SQL> shutdown normal
SQL> startup nomount


3. Use RMAN to duplicate the controlfile:
$ rman nocatalog
RMAN>connect target
RMAN>restore controlfile to '<DISKGROUP_NAME>' from '<OLD_PATH>';

RMAN> restore controlfile to '+DG1' from '/oradata2/102b/oradata/P10R2/control01.ctl';

Starting restore at 23-DEC-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 23-DEC-05


We are only specifying the name of the diskgroup, so Oracle will create an OMF (Oracle Managed File). Use ASMCMD or sqlplus to identify the name assigned to the controlfile

4. On the ASM instance, identify the name of the controlfile:

Using ASMCMD:
$ asmcmd
ASMCMD> cd <DISKGROUP_NAME>
ASMCMD> find -t controlfile . *

Changing the current directory to the diskgroup where the controlfile was created will speed the search.

Output:

ASMCMD> find -t controlfile . *
+DG1/P10R2/CONTROLFILE/backup.308.577785757
ASMCMD>

Note the name assigned to the controlfile. Although the name starts with the backup word, that does not indicate is a backup of the file. This just the name assigned for the identical copy of the current controlfile.

5. On the database side:

ü Modify init.ora or spfile, adding the new path to parameter control_files.

ü if using init<SID>.ora, just modify the control_files parameter and restart the database.

ü If using spfile,

1) startup nomount the database instance
2) alter system set control_files='+DG1/P10R2/CONTROLFILE/backup.308.577785757','/oradata2/102b/oradata/P10R2/control01.ctl' scope=spfile;

For RAC instance:

alter system set control_files='+DG1/P10R2/CONTROLFILE/backup.308.577785757','/oradata2/102b/oradata/P10R2/control01.ctl' scope=spfile sid='*';

3) shutdown immediate

4 start the instance.

Verify that new control file has been recognized. If the new controlfile was not used, the complete procedure needs to be repeated.

Case TwoDuplicating a controlfile into ASM using a specific name

It is also possible to duplicate the controlfile using a specific name for the new controlfile. In the following example, the controlfile is duplicated into a new diskgroup where controlfiles have not been created before.

On the ASM instance:

A. Create the directory to store the new controlfile.

SQL> alter diskgroup <DISKGROUP_NAME> add directory '+<DG_NAME>/<DB_NAME>/CONTROLFILE';

Note that ASM uses directories to store the files and those are created automatically when using OMF files. (just specifying the diskgroup name). Asumming that other OMF files were created on the diskgroup, the first directory (DB_NAME) already exist, so it is only required to create the directory for the controlfile.

SQL> alter diskgroup DG1 add directory '+DG1/P10R2/CONTROLFILE';

ASMCMD can also be used

ASMCMD>cd dg1
ASMCMD>mkdir controlfile

On the database instance:

B. Edit init.ora or spifile and modify parameter control_file:
control_files='+DG1/P10R2/CONTROLFILE/control02.ctl','/oradata2/102b/oradata/P10R2/control01.ctl'

C. Identify the location of the current controlfile:

SQL> select name from v$controfile;
NAME
--------------------------------------------------------------------------------
/oradata2/102b/oradata/P10R2/control01.ctl'


D. Shutdown the database and start the instance:
SQL> shutdown normal
SQL> startup nomount


E. Use RMAN to duplicate the controlfile:
$ rman nocatalog
RMAN>connect target
RMAN>restore controlfile to '<FULL PATH>' from '<OLD_PATH>';

RMAN> restore controlfile to '+DG1/PROD/controlfile/control02.ctl' from '/oradata2/102b/oradata/P10R2/control01.ctl';

Starting restore at 23-DEC-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 23-DEC-05


F. Start the database:
SQL> alter database mount;
SQL> alter database open;


Now, using ASMCMD to search for information for the controlfiles, the find -t contrlfile command will return two records. That does not indicate there were created two controlfiles. The name specified is an alias name and is only an entry in the ASM metadata (V$ASM_ALIAS). Oracle will create the alias and the OMF entry when user specifies the file name.

Case ThreeDuplicating a controlfile into ASM when original controlfile is stored on ASM

If using spfile to start the instance:

1. Modify the spfile specifically the parameter control_files. In this example, a second controlfile is going to be created on same diskgroup DATA1.

sql>altersystemsetcontrol_files='+DATA1/v102/controlfile/current.261.637923577','+DATA1' scope=spfilesid='*';



2. Start the instance in NOMOUNT mode.

3. From rman, duplicate the controlfile

$rmannocatalog
RMAN>connecttarget
RMAN>restorecontrolfilefrom'+DATA1/v102/controlfile/current.261.637923577';


The output for the execution is like:

Starting restore at 08-NOV-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 instance=V1021 devtype=DISK

channel ORA_DISK_1: copied control file copy
output filename=+DATA1/v102/controlfile/current.261.637923577
output filename=+DATA1/v102/controlfile/current.269.638120375
Finished restore at 08-NOV-07

Note that the command prints the name of the new created file: +DATA1/v102/controlfile/current.269.638120375

4. Mount and Open the database

RMAN>sql'alterdatabasemount';
RMAN>sql'alterdatabaseopen';



5. Validate both controlfiles are present

SQL>selectnamefromv$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA1/v102/controlfile/current.261.637923577
+DATA1/v102/controlfile/current.269.638120375



6. Modify the control_file parameter with the complete path of the new file:

sql>altersystemsetcontrol_files='+DATA1/v102/controlfile/current.261.637923577','+DATA1/v102/controlfile/current.269.638120375'
scope=spfilesid='*';


Next time instance are restarted, will pick both files.


When using init.ora file:


1) Edit init.ora and add new disk group name or same disk group name for mirroring controlfiles.

Example:

control_files=('+GROUP1','+GROUP2')


(2) Start the instance in NOMOUNT mode.

(3) Execute restore command, to duplicate the controlfile using the original location. Presuming, your current controlfile location DISK path is '+data/V10G/controlfile/Current.260.605208993' , execute:

RMAN> restore controlfile from '+data/V10G/controlfile/Current.260.605208993';

Starting restore at 29-APR-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=317 devtype=DISK

channel ORA_DISK_1: copied controlfile copy
output filename=+GROUP2/v10g/controlfile/backup.268.7
output filename=+GROUP2/v10g/controlfile/backup.260.5
Finished restore at 29-APR-05


(4) Mount and open the database:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> alter database open;

database opened

RMAN> exit


(5) Verify new mirrored controlfiles via sqlplus

SQL> show parameter control_files

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string +GROUP2/v10g/controlfile/backup.268.7, +GROUP2/v10g/controlfile/backup.260.5



From Oracle

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

Blog http://blog.csdn.net/tianlesoftware

Email: dvd.dba@gmail.com

DBA1 群:62697716(); DBA2 群:62697977() DBA3 群:62697850()

DBA 超级群:63306533(); DBA4 群: 83829929 DBA5群: 142216823

聊天 群:40132017 聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

分享到:
评论

相关推荐

    How to Duplicate Oracle DB on Another Server

    ### 如何使用Galaxy备份在另一服务器上复制Oracle 10g数据库 #### 概述 本文档将详细介绍如何使用Galaxy备份工具在一个新的服务器上复制一个Oracle 10g数据库。请注意,本文档仅供参考,并非是最终解决方案或标准...

    UE(官方下载)

    This is a convenient feature when you're manually comparing files, when you want to copy/paste between multiple files, or when you simply want to divide up your edit space. Tabbed Child Windows ...

    a project model for the FreeBSD Project.7z

    This project model is not meant to be a tool to justify creating impositions for developers, but as a tool to facilitate coordination. It is meant as a description of the project, with an overview of...

    Cody‘s_Data_Cleaning_Techniques_Using_SAS_(Second_Edtion)

    - **Selecting Patients with Duplicate Observations by Using a Macro List and SQL**: Shows how to select patients with duplicate observations using a macro list and SQL. - **Identifying Subjects with ...

    Vistanita Duplicate Finder

    重复文Restrictions ...6. Use the licensed version of Vistanita Duplicate Finder if you know that the copy you are using is illegal or the license itself is illegal or fake. 件删除工具

    Oracle RMAN Database Duplication(Apress,2015)

    and even across storage environments such as when duplicating from a RAC/ASM environment to a single-node instance using regular file system storage. Oracle RMAN Database Duplication is your thorough...

    Duplicate Email Remover 2.7

    To install Duplicate Email Remover, just run the "setup.exe" and follow the instructions. You'll need to select the target directory and the components to install. Notes for Microsoft Windows 95/98 ...

    Source Code Analytics With Roslyn and JavaScript Data Visualization(Apress,2016)

    This title will show readers how to use Roslyn along with industry standard JavaScript visualization APIs like HighCharts, D3.js etc to create a scalable and highly responsive source code analytics ...

    微软内部资料-SQL性能优化5

    Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...

    Big.Data.for.Chimps.A.Guide.to.Massive-Scale.Data.Processing.in.Practice.epub

    Finding patterns in massive event streams can be difficult, but learning how to find them doesn’t have to be. This unique hands-on guide shows you how to solve this and many other problems in large-...

    ORACLE Duplicate复制数据库

    RMAN&gt; DUPLICATE TARGET DATABASE TO TESTA FROM ACTIVE DATABASE; ``` #### 注意事项 - 确保目标数据库和辅助数据库的文件路径一致或通过相应的转换参数进行调整。 - 在执行RMAN备份时,需要确保有足够的磁盘...

    NewSID(光学习一下代码就可以了,没看清楚介绍别运行)

    When the SID is found in a value it is replaced with the new computer SID, and when the SID is found in a name, the key and its subkeys are copied to a new subkey that has the same name except with ...

    outlook duplicate items remover

    Outlook Duplicate Items Remover是一款专为Microsoft Outlook设计的工具,旨在帮助用户解决电子邮件、联系人、日历项、任务和笔记等重复数据的问题。在Outlook中,由于各种原因(如手动复制、同步错误或软件故障)...

    VclZip pro v3.10.1

    This was due to a problem where it would be freed automatically if there was a problem with the ArchiveStream when trying to open it as a zip file (possibly corrupt). Best practice is that ...

    BURNINTEST--硬件检测工具

    - Changes to trace logging to reduce activity when trace logging is not turned on. - Note: We have seen a report of the Video Playback failing (crash) due to a faulty video codec, ffdshow.ax. If ...

    S7A驱动720版本

    in the demo mode, or the value 1, when the driver has found a valid key, and therefore is licenced. This function is also available via the OPC server interface. The same item-ID address format has...

Global site tag (gtag.js) - Google Analytics