windows clone 迁移数据库

windows clone 迁移数据库可行.(c 盘底成复制)

 

### sample 1

如何备份 ORACLE_HOME 目录文件

How to take a backup of the Oracle Home?  This note only pertains to the ORACLE_HOME software and NOT databases.

SOLUTION

Backup of the Oracle home can be taken using any preferred method. You can use any tool such as zip, tar, and cpio to compress the Oracle home.

It is highly recommended to take a backup of the Oracle_Home binaries and Cnetral Inventory prior to applying patchsets or patches. It should also be done as part of a standard backup schedule.

It is also suggested but not mandatory that the database(s),listeners, any processes in the source home are shutdown so that cold backup of the Oracle Home software can be taken.  However if you are applying patches or patchsets the instructions stated in the README file may state a shutdown is required in which case a suggestion might be to take cold backups of the ORACLE_HOME during this scheduled maintenance outage.  Taking backups while Oracle processes are active should also be valid becuase any processes that load the static binaries or libraries into memory should not hold a write lock.  Again this note only speaks about the ORACLE_HOME software and not databases.

The backup must be taken by the user that owns the Oracle installation or root user.  The intention is to make sure that the ownership/permissions of the files is preserved correctly.

Below example shows use of tar command.

1. (Suggested but not mandatory) Shutdown databases, listeners, or any other processes related to the ORACLE_HOME which you are taking backup.

2. cd to the directory where ORACLE_HOME is located for example:

cd /u01/app/oracle/product/11.2

3. backup the ORACLE_HOME for example:

tar -pcvf /u01/app/oracle/backup/oracle_home_bkup.tar db1

In the above example, ORACLE_HOME is /u01/app/oracle/product/11.2/db1 and backup the directory is /u01/app/oracle/backup/

Below is an example of restoring the ORACLE_HOME:

1. (This step would be mandatory in the case of restore) Shutdown databases, listeners, or any other processes related to the ORACLE_HOME which you are restoring.

2. Go to the directory where ORACLE_HOME is located for example:

cd /u01/app/oracle/product/11.2

3. Rename or move the current ORACLE_HOME for example:

mv db1 db1_bkup

3. Restore the ORACLE_HOME for example:

tar -pxvf /u01/app/oracle/backup/oracle_home_bkup.tar

Make sure that is enough enough free disk space before doing the backup.

The Central Inventory where the Oracle_Home is registered should also be part of the backup plan and taken at the same time as the ORACLE_HOME backup for consistency.

The Central Inventory contains information relating to the Oracle_Home's installed on a host.  Review the following note for more information:

<Note 564192.1> FAQs on Central Inventory and Oracle Home Inventory (Local Inventory) in Oracle RDBMS

To determine where the Central Inventory (oraInventory) is located review the following file depending upon the platform:

/var/opt/oracle/oraInst.loc

or

/etc/oraInst.loc

The contents of oraInst.loc file will look something like this for example:

inventory_loc=/oracle/product/oraInventory
inst_group=dba

 

 

###sample 2:  clone 单机数据库。

 

AIX:
souce : 10.241.14.13
ORACLE_HOME=/dd/oracle/app/product/11g

(原始环境:) PSU 20181018 +6 one-off patch

 

##target: 10.241.21.214
#ORACLE_HOME=/dd/oracle/app/product/11g

target : 10.241.28.14

OLD:#ORACLE_HOME=/dd/oracle/app/product/11g

set NEW_HOME=
ORACLE_HOME=/dd/db/oradata/app_home

(目标环境:) PSU 20181018 +NONE one-off patch

##oracle/app/product/11g_2

确保2个节点UID .GID 都是一致

目的:
建议:尽量建议在linux 使用,或者AIX 测试环境下使用,确保clond的补丁环境 不包含 DB 运行.sql 部分。

目的是在one-off patch 时候,尽量使用已经安装的ORACLE_HOME 到新主机,生成一个新的ORACLE_HOME 目录:这样可以在线切换目录到 新的补丁版本,到新的ORACLE_HOME,

(如果涉及到PSU 的升级数据字典的升级,还是不建议使用这种方法),该方法只适用小补丁的升级 或者用于回退ORACLE_HOME 使用。


1.建议在root 用户下:(可以在DB运行时候CLONE,也可以回退)
大概5分钟

(不带绝对路径的tar,如果要克隆岛另一台主机的不同的目录,推荐使用这个方法)
cd $ORACLE_HOME

tar -cvf /dd/oracle/fra/clone/112homeclone_1_root.tar *


2.SCP到远程


scp *root*.tar aa@10.241.28.14:/dd/db/oradata/clone

3.解压 到指定目录


cd /dd/db/oradata/app_home
tar -xvf /dd/db/oradata/clone/*.tar

test sqlplus is ok
cd /dd/db/oradata/app_home
./sqlplus

 

4) :Clone of ORACLE_HOME:
export ORACLE_HOME=/dd/db/oradata/app_home

a).
use root:
sh /dd/db/oradata/app_home/clone/rootpre.sh

b)use oracle:
set umask 022,
export ORACLE_BASE=/dd/db/app/product
export ORACLE_HOME=/dd/db/oradata/app_home
export PATH=$ORACLE_HOME/bin:$PATH
cd /dd/db/oradata/app_home/clone/bin

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/dd/db/oradata/app_home ORACLE_HOME_NAME=11204_db_q2_0 ORACLE_BASE=/dd/db/app/product


c.if clone is successful:
use root:
sh /dd/db/oradata/app_home/root.sh


d):edite /etc/oratab
add new_home in the file
export ORACLE_HOME=/dd/db/oradata/app_home

f).eidt oracle use profile ( .profile or bash_profile )change oracle_home to new location:


5.检查inventory

after clone successful you are prompted to run root.sh and you can verify if oracle home is registered with below
~~~~~~~~~~~~~~~~~~~
grep /dd/db/oradata/app_home /dd/db/app/oraInventory/ContentsXML/inventory.xml


6).COPE $old_ORACLE_HOME/dbs ,and $old_ORACLE_HOME/network/admin to new_ORACLE_HOME/dbs and new_ORACLE_HOME/network/admin

in oralce user

cp -rp /dd/db/app/product/11g/dbs/* /dd/db/oradata/app_home/dbs/
ls -ltr /dd/db/oradata/app_home/dbs/*
cp -rp /dd/db/app/product/11g/network/admin/* /dd/db/oradata/app_home/network/admin/*
ls -ltr /dd/db/oradata/app_home/network/admin


7).
startup db and listener

 

 

########more inof:

 

https://docs.oracle.com/database/121/LADBI/app_cloning.htm#LADBI7854

感谢 KoolAid Rakesh's -汉服很是好看


Steps to clone 11.2 $ORACLE_HOME from one server to another
此问题已回答。

KoolAid
Expert
KoolAid 2013-6-26 上午1:11
Hi experts.
I nees the steps to clone 11.2 $ORACLE_HOME from one server to another.
Rakesh's - Oracle正确答案
作者: Rakesh's - Oracle 在 2013-6-26 上午1:11
Hello
As suggested by Giri you can use suggested documents if using oui ,if intrested in command line would suggest you to follow below instructions for cloning ORACLE_HOME (if both target and source server are of same platform).

Recommend to check http://docs.oracle.com/cd/E11882_01/install.112/e16763/app_cloning.htm -->cloning of oracle_home

Cloning of oracle home
~~~~~~~~~~~~~~~~~~~~~~

1)Take a backup of existing ORACLE_HOME
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
eg:- tar -cvf 11202homeclone.tar <directory where oracle software installed>

If source and target same skip to step 3

2)Move the tar file to destination server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3)Extract software in a new directory
``````````````````````````````````````````````
eg:- mkdir db_nonrac_q2_0
tar -xvf 11202homeclone.tar

4)Clone of ORACLE_HOME:
```````````````````````````````````
You can use following syntax for cloning ORACLE_HOME .

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=<newlocation where oracle home is copied or extracted> ORACLE_HOME_NAME=<anyname for oracle home> ORACLE_BASE=<Base of oracle home>

Note :invptrloc varies with respective OS platform(for linux and IBM AIX  /etc/oraInst.loc, HP-UX and Solaris /var/opt/oracle/oraInst.loc ),

Untar the required into new dbeated folder like “db_nonrac_q2_0” then clone as below :,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
example:-
``````````````````
FOR NON_RAC :

a)set umask 022,
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0
export PATH=$ORACLE_HOME/bin:$PATH
cd /u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0/clone/bin

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0 ORACLE_HOME_NAME=11202_db_nonrac_q2_0 ORACLE_BASE=/u01/app/oracle

after clone successful you are prompted to run root.sh and you can verify if oracle home is registered with below
~~~~~~~~~~~~~~~~~~~
grep /u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0 /u01/app/oracle/oraInventory/ContentsXML/inventory.xml

o/p of above is something similar to below
<HOME NAME="11202_db_nonrac_q2_0" LOC="/u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0" TYPE="O" IDX="16"/>,

 


FOR RAC –home :,
~~~~~~~~~~~~~~~~~~
you may have to execute below on each server
a)set umask 022,
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0
export PATH=$ORACLE_HOME/bin:$PATH,
cd /u01/app/oracle/product/11.2.0.2/db_rac_q2_0/clone/bin,

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0 ORACLE_HOME_NAME=11202_db_rac_q2_0 ORACLE_BASE=/u01/app/oracle '-O"CLUSTER_NODES={testdb1,testdb2,testdb3}"' '-O"LOCAL_NODE=testdb1"'

on testdb2 server
perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0 ORACLE_HOME_NAME=11202_db_rac_q2_0 ORACLE_BASE=/u01/app/oracle '-O"CLUSTER_NODES={testdb1,testdb2,testdb3}"' '-O"LOCAL_NODE=testdb2"'

on testdb3 server.
perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0 ORACLE_HOME_NAME=11202_db_rac_q2_0 ORACLE_BASE=/u01/app/oracle '-O"CLUSTER_NODES={testdb1,testdb2,testdb3}"' '-O"LOCAL_NODE=testdb3"'

grep /u01/app/oracle/product/11.2.0.2/db_rac_q2_0 /u01/app/oracle/oraInventory/ContentsXML/inventory.xml, <HOME NAME="11202_db_rac_q2_0" LOC="/u01/app/oracle/product/11.2.0.2/db_rac_q2_0" TYPE="O" IDX="25">,

hope this helps you

-Rakesh S
查看上下文中的回答
1318 查看标签:回复
平均用户评级: 无评分 (0 评级)平均用户评级无评分(0 评级)
您的评级:评级 差(1,最高值为 5)评级 中下(2,最高值为 5)评级 中等(3,最高值为 5)评级 中上(4,最高值为 5)评级 优(5,最高值为 5)
1. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
BPeaslandDBA
Grand Titan
BPeaslandDBA 2013-6-25 下午1:06 (回复 KoolAid)
You can easily clone if the OS is the same on both server. Here is a link to a blog site which contains the info on how to do it:
http://orawin.info/blog/2011/07/27/in-praise-of-clones/

This worked very, very well for me.


Cheers,
Brian
喜爱 显示 0 喜欢(0) 回复操作
2. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
KoolAid
Expert
KoolAid 2013-6-25 下午1:22 (回复 BPeaslandDBA)
Checking that sdbipt Brian!
喜爱 显示 0 喜欢(0) 回复操作
3. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
KoolAid
Expert
KoolAid 2013-6-25 下午1:32 (回复 BPeaslandDBA)
Does this environment variables takes its value automatically? from inside the sdbipt or I have to set it when I connect to the target server?
IMAGE=$1
INSTLOC=$2
ORABASE=$3
HOMENAME=$4
喜爱 显示 0 喜欢(0) 回复操作
4. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
KoolAid
Expert
KoolAid 2013-6-25 下午2:52 (回复 BPeaslandDBA)
# tar -cpvzf /home/oracle/db112.tgz .tar: illegal option -- z

Aix 6.1


喜爱 显示 0 喜欢(0) 回复操作
5. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
BPeaslandDBA
Grand Titan
BPeaslandDBA 2013-6-25 下午3:42 (回复 KoolAid)
$1, $2, $3, and $4 refer to the first, second, third, and fourth parameters respectively. If you do not supply four parameters on the command line, you will get an error that says:
Usage : installOracle.sh imageName instLoc oracle_base HomeName

So you supply the image name, the install location, the oracle base and oracle home name.


Cheers,
Brian
喜爱 显示 0 喜欢(0) 回复操作
6. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
BPeaslandDBA
Grand Titan
BPeaslandDBA 2013-6-25 下午3:43 (回复 KoolAid)
> tar: illegal option -- z
Check your man pages on your OS. I don't have AIX so I cannot check. See if the tar utility supports gzip, which is what the -z option is telling it to do.

Cheers,
Brian
喜爱 显示 0 喜欢(0) 回复操作
7. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
Girisha M -Oracle
Super Elite
Girisha M -Oracle 2013-6-25 下午8:17 (回复 KoolAid)
Hi ,
If source and destination identical setup please follow below steps:

1) Copy the ORACLE_HOME from A to B (keeping the oracle_home path and other variable intact)
-- Next step required --
2) As the server A and B are identical - a relink of binaries are required

syntax
export ORACLE_HOME=<path_of oracle_home>
$ORACLE_HOME/bin/relink all

3) verify the DB start and shut

4) if the DB is same as server A then just copy the /etc/oratab file from A to B.
if not - dbeate one for this DB @ servr B

format
SID:<ORACLE_HOME patch>: Y/N (Y= start the DB auto when the OS starts , N = to not start)

Example:

mydbsid:/oracle/home/path/11.2:N


Also refer following MOS documents:
Note.1221705.1 - Cloning An Existing Oracle11g Release 2 (11.2.0.x) RDBMS Installation Using OUI
Note.1154613.1 - Master Note For Cloning Oracle Database Server ORACLE_HOME's Using the Oracle Universal Installer (OUI)
FAQs on RDBMS Oracle Home Cloning Using OUI [ID 565009.1]

 

---Hope This Helps---
Thanks,
Giri


喜爱 显示 0 喜欢(0) 回复操作
正确答案8. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another
Rakesh's - Oracle
Expert
Rakesh's - Oracle 2013-6-26 上午1:11 (回复 Girisha M -Oracle)
Hello
As suggested by Giri you can use suggested documents if using oui ,if intrested in command line would suggest you to follow below instructions for cloning ORACLE_HOME (if both target and source server are of same platform).

Recommend to check http://docs.oracle.com/cd/E11882_01/install.112/e16763/app_cloning.htm -->cloning of oracle_home

Cloning of oracle home
~~~~~~~~~~~~~~~~~~~~~~

1)Take a backup of existing ORACLE_HOME
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
eg:- tar -cvf 11202homeclone.tar <directory where oracle software installed>

If source and target same skip to step 3

2)Move the tar file to destination server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3)Extract software in a new directory
``````````````````````````````````````````````
eg:- mkdir db_nonrac_q2_0
tar -xvf 11202homeclone.tar

4)Clone of ORACLE_HOME:
```````````````````````````````````
You can use following syntax for cloning ORACLE_HOME .

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=<newlocation where oracle home is copied or extracted> ORACLE_HOME_NAME=<anyname for oracle home> ORACLE_BASE=<Base of oracle home>

Note :invptrloc varies with respective OS platform(for linux and IBM AIX  /etc/oraInst.loc, HP-UX and Solaris /var/opt/oracle/oraInst.loc ),

Untar the required into new dbeated folder like “db_nonrac_q2_0” then clone as below :,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
example:-
``````````````````
FOR NON_RAC :

a)set umask 022,
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0
export PATH=$ORACLE_HOME/bin:$PATH
cd /u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0/clone/bin

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0 ORACLE_HOME_NAME=11202_db_nonrac_q2_0 ORACLE_BASE=/u01/app/oracle

after clone successful you are prompted to run root.sh and you can verify if oracle home is registered with below
~~~~~~~~~~~~~~~~~~~
grep /u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0 /u01/app/oracle/oraInventory/ContentsXML/inventory.xml

o/p of above is something similar to below
<HOME NAME="11202_db_nonrac_q2_0" LOC="/u01/app/oracle/product/11.2.0.2/db_nonrac_q2_0" TYPE="O" IDX="16"/>,

FOR RAC –home :,
~~~~~~~~~~~~~~~~~~
you may have to execute below on each server
a)set umask 022,
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0
export PATH=$ORACLE_HOME/bin:$PATH,
cd /u01/app/oracle/product/11.2.0.2/db_rac_q2_0/clone/bin,

perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0 ORACLE_HOME_NAME=11202_db_rac_q2_0 ORACLE_BASE=/u01/app/oracle '-O"CLUSTER_NODES={testdb1,testdb2,testdb3}"' '-O"LOCAL_NODE=testdb1"'

on testdb2 server
perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0 ORACLE_HOME_NAME=11202_db_rac_q2_0 ORACLE_BASE=/u01/app/oracle '-O"CLUSTER_NODES={testdb1,testdb2,testdb3}"' '-O"LOCAL_NODE=testdb2"'

on testdb3 server.
perl ./clone.pl -invPtrLoc /etc/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/db_rac_q2_0 ORACLE_HOME_NAME=11202_db_rac_q2_0 ORACLE_BASE=/u01/app/oracle '-O"CLUSTER_NODES={testdb1,testdb2,testdb3}"' '-O"LOCAL_NODE=testdb3"'

grep /u01/app/oracle/product/11.2.0.2/db_rac_q2_0 /u01/app/oracle/oraInventory/ContentsXML/inventory.xml, <HOME NAME="11202_db_rac_q2_0" LOC="/u01/app/oracle/product/11.2.0.2/db_rac_q2_0" TYPE="O" IDX="25">,

hope this helps you

-Rakesh S

 

 

 

########SAMPLE 2:

How to move RAC Database ORACLE_HOME from one location to another one (Doc ID 1438719.1) To BottomTo Bottom

In this Document
Goal
Solution
APPLIES TO:
Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.
GOAL
What are the steps to move the RAC database ORACLE_HOME from one location(filesystem) to another one?

This note is for database home only and does not apply to dbS or GI home.

SOLUTION

Execute all the following as database user:


Solution 1:

1. Install a new set of RAC binaries with OUI into a new home
2. Apply all patches that have been installed in the old home, use "opatch lsinventory" to compare the old and new home once all patches are applied.
3. Copy over init{ORACLE_SID}.ora in dbs directory from the old home to the new home on all nodes
4. Copy over network files (listener.ora, tnsnames.ora, and sqlnet.ora) in network/admin directory from the old home to the new home on all nodes
5. Shutdown the database with srvctl from the old database home: srvctl stop database -d <dbname>
6. Modify the database resource as with srvctl from the old database home: srvctl modify database -d -o <new-database-home>
7. Start the database with srvctl from the new database home: srvctl start database -d <dbname>

Solution 2: (Clone)

1. Copy existing RAC binaries to a new location and keep the same ownership/permission on any node: cp -rp <old-database-home> <new-database-home>
2. Execute:

$ export ORACLE_HOME=$DB_HOME

$ perl $ORACLE_HOME/clone/bin/clone.pl '-O"CLUSTER_NODES={<comma separated listed of hostnames>}"' '-O"LOCAL_NODE=<this host’s hostname>"' ORACLE_BASE=<ORACLE_BASE> ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=<inventory name> '-O-noConfig' "

Refer to: https://docs.oracle.com/cd/E11882_01/rac.112/e41960/clonerac.htm

3. Extend the new home to other nodes: <new-database-home>/oui/bin/addNode.sh
4. Go to Step3 of "Solution 1"


##SAMPLE 3:


复杂3:

解决方案
总览
克隆并为集群管理软件(GRID)打补丁
概览
预先检查:
开始克隆:
为克隆的grid home打补丁
切换到克隆的grid home
克隆并为数据库软件 (RDBMS)打补丁
开始克隆:
在克隆的目录打补丁
切换到克隆的目录
修改数据库
重启数据库和相关服务, 应用post-install SQL脚本
清理
参考
适用于:
Oracle Exadata Hardware - 版本 11.2.0.1 到 11.2.0.4 [发行版 11.2]
Oracle Database - Enterprise Edition - 版本 11.2.0.1.0 到 11.2.0.4 [发行版 11.2]
Oracle Database Exadata Cloud Machine - 版本 N/A 和更高版本
Oracle Cloud Infrastructure - Database Service - 版本 N/A 和更高版本
Oracle Database Cloud Exadata Service - 版本 N/A 和更高版本
本文档所含信息适用于所有平台
目标
本文描述了如何在尽量减少停机时间和风险的前提下,为集群环境的RDBMS HOME和GRID HOME打补丁。

解决方案
总览
本文提供了一种最小化停机时间为ORACLE_HOME打补丁的方法。为了实现最小化停机时间,现有的RDBMS HOME和GRID HOME被克隆到新的位置,之后在被克隆的目录打补丁。在被克隆目录打补丁不需要停机时间,从而降低了打补丁所需的停机时间;如果出现问题也可以通过切换回之前ORACLE_HOME的方式进行回滚,从而降低了风险。
克隆的过程和在被克隆的ORACLE_HOME打补丁的过程不会影响正在运行的数据库。切换到克隆ORACLE_HOME的过程需要在一个节点重启数据库服务。大体上 :


推荐使用Oplan来生成自己的plan,请参考Note 1306814.1了解更多信息。
本文使用的命令是通过oplan生成的。但是,客户最好生成适合自己环境的oplan。请参考文档2087150.1了解更多关于oplan的信息,这篇文档适用于版本12.1,但是oplan在11.2经过测试也是可用的。如果在使用oplan时遇到错误或者问题,本文的步骤也可以被使用。
本文使用的环境是运行Linux操作系统的Exadata环境,对于非Exadata环境同样适用。唯一的区别是dcli命令的使用,它可以在多个Exadata 环境同时运行同样的命令。
对于运行Oracle 11gR1的Exadata 环境,请参考 Note 1092797.1
对于运行Oracle 12db1的Exadata 环境,请参考 Note 2087150.1

 

 

 

 

 

###clone rac db gid and db soft

 

假设OS内核参数,ASM盘,网络参数配置,网卡都已经按照需求已经在新主机完成调试了

1.old 节点 node 1 ,node2

cp -prf /db/db/grid/ /db/db/grid/clone
cp -prf /db/db/grid/11.2.0 /db/db/grid/clone


2.
cd /db/db/grid/clone/11.2.0

#host_name is dbrac1

rm -rf dbrac1
rm -rf log/dbrac1
rm -rf gpnp/dbrac1

find gpnp -type f -exec rm -f {} \;
find cfgtoollogs -type f -exec rm -f {} \;
rm -rf dbs/init/*
rm -rf cdata/*
rm -rf dbf/*
rm -rf network/admin/*.ora
find . -name '*.ouibak' -exec rm {} \;
find . -name '*.ouibak.1' -exec rm {} \;
rm -rf root.sh*

 

Compress the files ,只做一次

cd /db/db/grid/clone/11.2.0
tar -cvpf /db/db/grid/clone/gridHome.tgz .


cd /db/db/app/db/product/11204
tar -cvpf /db/db/grid/clone/oraHome.tar .

3.新节点上确保这些准备工作做到位

the new cluster have been set up with correct kernel parameters, meet all networking requirements, have all ASM devices configured,
shared and available and CVU has been run successfully to verify OS and Hardware setup.
dbeate the same directory structure on each of the new nodes of the new cluster into which you will restore the copy of the Grid Infrastructure Home.
You should ensure that the permissions are correct for both the new Grid Home and the oraInventory directory.

(确保原来的cluster 目录和现在的节点cluster 目录一样)。

As root user

#mkdir -p /u01/11.2.0/grid
cd /db/db/grid/11.2.0
tar -xvf gridHome.tgz

dbeate the oraInventory directory:

#mkdir -p /u01/oraInventory
#chown oracle:oinstall /u01/oraInventory
#chown -R oracle:oinstall /u01/11.2.0/grid

#It is necessary to add the setuid and setgid from the binaries and you should run:

chmod u+s /db/db/grid/11.2.0/bin/oracle
chmod g+s /db/db/grid/11.2.0/bin/oracle
chmod u+s /db/db/grid/11.2.0/bin/extjob
chmod u+s /db/db/grid/11.2.0/bin/jssu
chmod u+s /db/db/grid/11.2.0/bin/oradism

#Run the clone.pl on the Destination Node.
#Just to clarify, at this point we are working on our new node, we have extracted the copied software,

ensuring that all permissions are correct and unwanted files have been removed.

->Node1/2 root用户安装
cd /db/db/grid/11.2.0/clone
sh rootpre.sh

-->> Node1/2 Grid 用户安装
As the grid owner (oracle):-

#The clone command needs to be run on each node of the new cluster. This command prepares the new Grid Infrastructure Home
# for entry into the central inventory (/u01/oraInventory) and relinks the binaries.

$ cd /db/db/grid/11.2.0/clone/bin
$ perl clone.pl -silent -debug ORACLE_BASE=/db/db/app/grid ORACLE_HOME=\
/db/db/grid/11.2.0 ORACLE_HOME_NAME=OraHome1Grid \
OSDBA_GROUP=dba OSOPER_GROUP=dba \
INVENTORY_LOCATION=/db/db/app/oraInventory '-O"CLUSTER_NODES={dbrac3,dbrac4}"' \
-O'"LOCAL_NODE=dbrac3"' dbS=TRUE -ignoreSysPrereqs


##clone meet errors:
perl clone.pl -silent -debug ORACLE_BASE=/db/db/app/grid ORACLE_HOME=\
问题:
clone could not backup bin/emctlcommon.pm.template

解决办法:
root 用户:
cd $ORACLE_HOME
tar -cvf bin.tar bin
感谢 798463 Gianluca (https://community.oracle.com/thread/3911613)
$ cd $ORACLE_HOME
$ chown -R grid:oinstall bin

## in grid user:
-->这里指定OSDBA_GROUP 和 OSOPER_GROUP 都是DBA 属组 ,按照道理,home/grid/config.rsp文件配置,gird clone 应该OSDBA_GROUP 是asmdba, OSOPER_GROUP应该是asmoper
$ cd /db/db/grid/11.2.0/clone/bin
$ perl clone.pl -silent -debug ORACLE_BASE=/db/db/app/grid ORACLE_HOME=\
/db/db/grid/11.2.0 ORACLE_HOME_NAME=OraHome1Grid \
OSDBA_GROUP=asmdba OSOPER_GROUP=asmoper \
INVENTORY_LOCATION=/db/db/app/oraInventory '-O"CLUSTER_NODES={dbrac3,dbrac4}"' \
-O'"LOCAL_NODE=dbrac4"' dbS=TRUE -ignoreSysPrereqs

->>clone 完成后,-->> Node1/2 Grid 用户 根据要求执行脚本
as root user:-
./u01/oraInventory/orainstRoot.sh
./u01/11.2.0/grid/root.sh

-》执行roots.sh 很快10秒钟完成
检查日志会发现提示如下:由于暂时不能使用图形界面,尝试使用默认方式 运行config.sh

-》由于暂时不能使用图形界面,尝试使用默认方式
#It is now time to configure the new cluster – this can be done via the Configuration Wizard (a GUI interface) or silently via a response file.
#Launch the Configuration Wizard
#The Configuration Wizard helps you to prepare the new dbsconfig_params file which is copied adboss all nodes of the cluster,

# prompting you to run root.sh sdbipt (which calls the rootconfig sdbipt), and runs cluster post-install verifications.
#You will need to have the list of public, private, and virtual IP address, ASM devices, scan names etc.
# This article assumes that you are familiar with these requirements and does not go into further detail.

##(重要一步)
####./db/db/grid/11.2.0/dbs/config/config.sh


##conifg.sh 需要调用rsp 模板文件 (也需要从源环境的 /home/grid/GRID.RSP 拷贝过来,以下是模本,需要修改根据实际情况部分)

Filename config.rsp (can save in /home/grid/config.rsp)
==================================================================
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbsinstall_response_schema_v11_2_0
INVENTORY_LOCATION=/u01/oraInventory
SELECTED_LANGUAGES=en
oracle.install.option=dbS_CONFIG
ORACLE_BASE=/u01/base
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=oinstall
oracle.install.dbs.config.gpnp.scanName=strkf-scan 《-节点1,2已经修改,
oracle.install.dbs.config.gpnp.scanPort=1521
oracle.install.dbs.config.clusterName=strkf 《-节点1,2已经修改
oracle.install.dbs.config.gpnp.configureGNS=false
oracle.install.dbs.config.gpnp.gnsSubDomain=
oracle.install.dbs.config.gpnp.gnsVIPAddress=
oracle.install.dbs.config.autoConfigureClusterNodeVIP=false
oracle.install.dbs.config.clusterNodes=strkf42.us.oracle.com:strkf42-vp.us.oracle.com,strkf43.us.oracle.com:strkf43-vp.us.oracle.com 《-已经修改
#-------------------------------------------------------------------------------
# The value should be a comma separated strings where each string is as shown below
# InterfaceName:SubnetMask:InterfaceType
# where InterfaceType can be either "1", "2", or "3"
# (1 indicates public, 2 indicates private, and 3 indicates the interface is not used)
#
# For example: eth0:140.87.24.0:1,eth1:10.2.1.0:2,eth2:140.87.52.0:3
#
#-------------------------------------------------------------------------------
oracle.install.dbs.config.networkInterfaceList=eth0:130.xx.xx.0:1,eth1:10.xx.xx.0:2
oracle.install.dbs.config.storageOption=ASM_STORAGE
oracle.install.asm.SYSASMPassword=oracle1234 《-节点1,2已经修改
oracle.install.asm.diskGroup.name=DATA
oracle.install.asm.diskGroup.redundancy=EXTERNAL
oracle.install.asm.diskGroup.AUSize=8
oracle.install.asm.diskGroup.disks=/dev/mapper/lun01,/dev/mapper/lun02
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/mapper/lun0*
oracle.install.asm.monitorPassword=oracle1234 《-节点1,2已经修改
oracle.install.asm.upgradeASM=false
[ConfigWizard]
oracle.install.asm.useExistingDiskGroup=false
==================================================================

 

-->>修改文件
cd /db/db/grid/11.2.0/dbs/install
cat /db/db/grid/11.2.0/dbs/install/dbsconfig_params, 在最后添加以下内容

########################################
## My Configuration for a cloned GI
## 必须为 2
dbS_STORAGE_OPTION=2
Odb_LOCATIONS=/dev/rhdisk6,/dev/rhdisk7,/dev/rhdisk8,/dev/rhdisk9,/dev/rhdisk10
VOTING_DISKS=/dev/rhdisk6,/dev/rhdisk7,/dev/rhdisk8,/dev/rhdisk9,/dev/rhdisk10
CLUSTER_NAME=db2-cluster
HOST_NAME_LIST=dbrac3,dbrac4
NODE_NAME_LIST=dbrac3,dbrac4
NODELIST=dbrac3,dbrac4
PRIVATE_NAME_LIST=dbrac3-priv,dbrac4-priv


SCAN_NAME=dbrac2-scan
SCAN_PORT=1528


NETWORKS="en0"/10.241.28.0:public,"en1"/190.0.28.0:cluster_interconnect
dbS_NODEVIPS='dbrac3-vip/255.255.255.0/en0,dbrac4-vip/255.255.255.0/en1'

########################################


#->>2边脚本跑完后 Node1 Grid 用户 根据要求执行脚本,只要在节点1执行即可
#To run config.sh silently:-
#As gird user:
#cd /u01/11.2.0/grid/dbs/config
cd /db/db/grid/11.2.0/dbs/config/
./config.sh -silent -responseFile /home/grid/config.rsp -ignoreSysPrereqs -ignorePrereq -ignoreInternalDriverError
或者
#./config.sh -silent -responseFile /home/grid/config.rsp -ignoreSysPrereqs -ignorePrereq

 

#->脚本跑完后 根据提示Node1/2 root 用户 根据要求执行脚本

./db/db/grid/11.2.0/root.sh

##节点1/2碰到了issue 3、4,5,解决办法见下文
##节点2 遇到了issue 7

##碰到了issue 3 ,解决后re-run
/db/db/grid/11.2.0/root.sh

##遇到issud 5,
解决后re-run
/db/db/grid/11.2.0/root.sh


##iseue 1:
./config.sh 报错cluster_name is too long than 15 charater

解决办法:
修改2个文件
vi /db/db/grid/11.2.0/dbs/install/dbsconfig_params
vi /home/grid/config.rsp

修改为
db2-cluster


####issue 2:

./config.sh [INS-30001] the sys/asmsnmp password should not be empty
解决办法:
修改1个文件
vi /home/grid/config.rsp

oracle.install.asm.monitorPassword=oracle1234
oracle.install.asm.SYSASMPassword=oracle1234

 

###issue 3:
##感谢oracle原厂Doc ID 2287067.1
最后节点1,root.sh 日志报错 oracle binary is currently linked with rac disable;

解决办法:
#use root:

export ORACLE_HOME=/db/db/grid/11.2.0
ar -X32_64 -t $ORACLE_HOME/rdbms/lib/libknlopt.a|grep kcsm.o

cd /db/db/grid/11.2.0/rdbms/lib
make -f ins_rdbms.mk rac_on ioracle


###issue 4
##感谢 Mariami Kupatadze https://dba010.com/2018/11/04/ora-17635-failure-in-obtaining-physical-sector-size-for-data/
running root.sjh dbeation of asm spfile in asm disk group failed
ora-01017
ora-17635

in grid:
sqlplus / as sysdba
报错ora-01017

原因:
权限不对:

1.
My permissions:

$ ll /u01/app/18.3.0/grid/bin/oracle
-rwxr-x--x 1 grid oinstall 413844056 Nov 4 09:14 /u01/app/18.3.0/grid/bin/oracle
Must be:

$ ll /u01/app/18.3.0/grid/bin/oracle
-rwsr-s--x 1 grid oinstall 413844056 Nov 4 08:45 /u01/app/18.3.0/grid/bin/oracle


解决办法:
step1:
$ cd $ORACLE_HOME/bin
$ chown -R grid:oinstall oracle


step 2.加入属组
#mkuser id='1001' pgrp='oinstall' groups='asmadmin,asmdba,asmoper' home='/home/grid' grid
usermod -g oinstall -G asmadmin,asmdba,asmoper,dba grid

 

###issue 5

运行root.sh asm failed to start ,configuartion of asm failed.


原因:
检查日志,发现删除ADR目录该目录在创建库时创建,但在克隆的时候不创建,因此需要单独去创建] Automatic Diagnostic Repository (ADR)
directory structure in $ORACLE_BASE/diag

解决办法:

cd /db/db/app/grid
ls -ltr
chown -R grid:oinstall diag


##grid user
$ORACLE_HOME/bin/diagsetup basedir=/db/db/app/grid oraclehome=/db/db/grid/11.2.0

 

###issue 6
问题:
dbeate diskgroup ora-15018


原因:

lscfg -vl hdisk9


解决办法:
找存储人员支持
或者直接
cfmgr -l fcs0


###issue 7
感谢ningmeng,oracle 原厂

节点2 执行 root.sh 报错 failed to start ASM at dbsconfig_lib.pm line 1346

同时在
以及alert 日志报错
GIM-00090
GIM-00091
GIM-00092 OS failure occurred at: sskgmsmr_7

原因:
尝试手工启动ASM
sqlplus / as sysasm
startup

报错:
ora-00304


解决办法:

1.节点2的profile配置问题
修改
ORACLE_SID=db2

2.and re-run
/db/db/grid/11.2.0/root.sh

3.and 参考 issue 4 步骤2, $ORACLE_HOME/bin/oracle 权限都是正确的。

4.and 确保$ORACLE_HOME/dbs 没有多余的文件。

比如节点2 同时有 hc_<INST_NAME>1.dat ,hc_<INST_NAME>2.dat,那么hc_<INST_NAME>1.dat 是多余的

同时hc_<SID>.dat 的权限是grid 用户,如果不是的,grid 用户创建一个文件

touch $ORACLE_HOME/dbs/hc_<SID>.dat

 

-------------------克隆oracle 软件----------------------------
参考文档:
Cloning An Existing Oracle11g Release 2 (11.2.0.x) RDBMS Installation Using OUI (文档 ID 1221705.1)


两个节点都执行:Node1/Node2
cd /db/db/app/db/product/11204
tar -xvf oraHome.tgz


su - oracle
cd $ORACLE_HOME/clone/bin
--这里INVENTORY_LOCATION 指的是DB 的INVENTORY_LOCATION,不是GI 的INVENTORY_LOCATION.
--Node1
perl clone.pl -silent -debug ORACLE_BASE=/db/db/app/db ORACLE_HOME=/db/db/app/db/product/11204 ORACLE_HOME_NAME=DB1HOME INVENTORY_LOCATION=/db/db/app/db/oraInventory OSDBA_GROUP=oinstall OSOPER_GROUP=dba -O'"CLUSTER_NODES={dbrac3,dbrac4}"' -O'"LOCAL_NODE=dbrac3"' -ignoreSysPrereqs
--Node2
perl clone.pl -silent -debug ORACLE_BASE=/db/db/app/db ORACLE_HOME=/db/db/app/db/product/11204 ORACLE_HOME_NAME=DB1HOME INVENTORY_LOCATION=/db/db/app/db/oraInventory OSDBA_GROUP=oinstall OSOPER_GROUP=dba -O'"CLUSTER_NODES={dbrac3,dbrac4}"' -O'"LOCAL_NODE=dbrac4"' -ignoreSysPrereqs

 

->检查是否RAC选项(如果没有任何返回说明RAC option没有link 如果返回kcsm.o则表时已经enable了RAC option)

export ORACLE_HOME=/db/db/app/db/product/11204
ar -X32_64 -t $ORACLE_HOME/rdbms/lib/libknlopt.a|grep kcsm.o

如果返回为空,需要执行如下
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk rac_on
make -f ins_rdbms.mk ioracle

 

###ps clone 脚本
-debug

 

posted @ 2017-02-28 16:13  feiyun8616  阅读(461)  评论(0编辑  收藏  举报