天天看點

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:

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 [email protected]:/dd/db/oradata/clone

3.解壓 到指定目錄

cd /dd/db/oradata/app_home

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

test sqlplus is ok

./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:

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

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

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 2013-6-25 下午1:22 (回複 BPeaslandDBA)

Checking that sdbipt Brian!

3. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another

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

4. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another

KoolAid 2013-6-25 下午2:52 (回複 BPeaslandDBA)

# tar -cpvzf /home/oracle/db112.tgz .tar: illegal option -- z

Aix 6.1

5. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another

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.

6. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another

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.

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

正确答案8. Re: Steps to clone 11.2 $ORACLE_HOME from one server to another

Rakesh's - Oracle

Rakesh's - Oracle 2013-6-26 上午1:11 (回複 Girisha M -Oracle)

########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.

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 ,隻做一次

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 使用者:

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

OSDBA_GROUP=asmdba OSOPER_GROUP=asmoper \

-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

##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個檔案

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:

-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

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

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

如果傳回為空,需要執行如下

cd $ORACLE_HOME/rdbms/lib

make -f ins_rdbms.mk rac_on

make -f ins_rdbms.mk ioracle

炊煙起了;夕陽下了;細雨來了

多調試,互動式程式設計體驗

記錄,獨立思考,對比

感謝轉載作者

修車

國産化

read and connect

匍匐前進,

講故事