Hostname değişikliği sonrası grid’i deconfig etmek gerekiyor. Bunu yaparken “Can’t locate Env.pm in @INC” hatasını aldığımızda …grid/perl/lib/5.14.1/Env.pm file’ını “/usr/share/perl5/vendor_perl” altına kopyalayıp roothas.pl file’ı unlock etmek gerekiyor;

 

[root@testdb01 ~]# export ORACLE_HOME=/oracle/app/grid 
[root@testdb01 ~]# cd /oracle/app/oracle/product/12.1.0/grid
[root@testdb01 grid]# export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/grid
[root@testdb01 grid]# cd crs/install
[root@testdb01 install]# pwd
/oracle/app/oracle/product/12.1.0/grid/crs/install

[root@testdb01 install]# ./roothas.pl -deconfig -force
Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . . ./../../perl/lib) at crsinstall.pm line 214.
BEGIN failed--compilation aborted at crsinstall.pm line 214.
Compilation failed in require at ./roothas.pl line 94.
BEGIN failed--compilation aborted at ./roothas.pl line 94.
[root@testdb01 install]# which roothas.pl
/usr/bin/which: no roothas.pl in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@testdb01 install]# ./roothas.pl -deconfig -force
Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . . ./../../perl/lib) at crsinstall.pm line 214.
BEGIN failed--compilation aborted at crsinstall.pm line 214.
Compilation failed in require at ./roothas.pl line 94.
BEGIN failed--compilation aborted at ./roothas.pl line 94.

[root@testdb01 install]# 
[root@testdb01 install]# 
[root@testdb01 install]# find . -name Env.pm -print
[root@testdb01 install]# ./roothas.pl -unlock
Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . . ./../../perl/lib) at crsinstall.pm line 214.
BEGIN failed--compilation aborted at crsinstall.pm line 214.
Compilation failed in require at ./roothas.pl line 94.
BEGIN failed--compilation aborted at ./roothas.pl line 94.
[root@testdb01 install]# 
[root@testdb01 install]# cp -i /oracle/app/oracle/product/12.1.0/grid/perl/lib/5.14.1/Env.pm /usr/share/perl5/vendor_perl
[root@testdb01 install]# ./roothas.pl -unlock
Using configuration parameter file: ./crsconfig_params
2017/08/09 14:37:52 CLSRSC-185: Could not open file /oracle/app/oracle/product/12.1.0/grid/crs/utl/testdb01/crsconfig_dirs (error: No such file or directory)

Died at crsutils.pm line 1826.

[root@testdb01 install]# 
[root@testdb01 install]# ./roothas.pl -deconfig -force
Using configuration parameter file: ./crsconfig_params
2017/08/09 14:38:44 CLSRSC-337: Successfully deconfigured Oracle Restart stack

[root@testdb01 install]# ./roothas.pl
Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE 
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node testdb01 successfully pinned.
2017/08/09 14:39:07 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'

testdb01 2017/08/09 14:40:18 /oracle/app/oracle/product/12.1.0/grid/cdata/testdb01/backup_20170809_144018.olr 84895804 
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'testdb01'
CRS-2673: Attempting to stop 'ora.evmd' on 'testdb01'
CRS-2677: Stop of 'ora.evmd' on 'testdb01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'testdb01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
2017/08/09 14:40:35 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

[root@testdb01 install]# cd /oracle/app/oracle/product/12.1.0/grid
[root@testdb01 grid]# 
[root@testdb01 grid]# ./root.sh
Performing root user operation.

The following environment variables are set as:
 ORACLE_OWNER= oracle
 ORACLE_HOME= /oracle/app/oracle/product/12.1.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) 
[n]: y
 Copying oraenv to /usr/local/bin ...
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /oracle/app/oracle/product/12.1.0/grid/crs/install/crsconfig_params
2017/08/09 14:42:01 CLSRSC-350: Cannot configure two CRS instances on the same cluster

2017/08/09 14:42:01 CLSRSC-352: CRS is already configured on this node for the CRS home location /oracle/app/oracle/product/12.1.0/grid

The command '/oracle/app/oracle/product/12.1.0/grid/perl/bin/perl -I/oracle/app/oracle/product/12.1.0/grid/perl/lib -I/oracle/app/oracle/product/12.1.0/grid/crs/install /oracle/app/oracle/product/12.1.0/grid/crs/install/roothas.pl ' execution failed
[root@testdb01 grid]#

[root@testdb01 grid]# cd bin
[root@testdb01 bin]# ./crsctl modify resource "ora.cssd" -init -attr "AUTO_START=1" 
[root@testdb01 bin]# ./crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'testdb01'
CRS-2673: Attempting to stop 'ora.evmd' on 'testdb01'
CRS-2677: Stop of 'ora.evmd' on 'testdb01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'testdb01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@testdb01 bin]# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[root@testdb01 bin]# ./crsctl check has
CRS-4638: Oracle High Availability Services is online
[root@testdb01 bin]# ./crsctl check css
CRS-4529: Cluster Synchronization Services is online

[root@testdb01 bin]# ./crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details 
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
 OFFLINE OFFLINE testdb01 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
 1 ONLINE ONLINE testdb01 STABLE
ora.diskmon
 1 OFFLINE OFFLINE STABLE
ora.evmd
 1 ONLINE ONLINE testdb01 STABLE
--------------------------------------------------------------------------------

[root@testdb01 bin]# ./srvctl add listener
[root@testdb01 bin]# ./srvctl start listener
[root@testdb01 bin]# 
[root@testdb01 bin]# ./crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details 
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
 ONLINE ONLINE testdb01 STABLE
ora.ons
 OFFLINE OFFLINE testdb01 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
 1 ONLINE ONLINE testdb01 STABLE
ora.diskmon
 1 OFFLINE OFFLINE STABLE
ora.evmd
 1 ONLINE ONLINE testdb01 STABLE
--------------------------------------------------------------------------------

[root@testdb01 bin]# cd ..
[root@testdb01 grid]# cd dbs
[root@testdb01 dbs]# ls -la
total 20
drwxr-xr-x. 2 oracle oinstall 4096 Aug 9 13:25 .
drwxr-x---. 78 root oinstall 4096 Aug 9 10:49 ..
-rw-rw---- 1 oracle oinstall 2989 Aug 9 11:24 ab_+ASM.dat
-rw-rw----. 1 oracle oinstall 1544 Aug 9 13:25 hc_+ASM.dat
-rw-r--r--. 1 oracle oinstall 2992 Feb 3 2012 init.ora
[root@testdb01 dbs]# vi init+ASM.ora
*.asm_power_limit=1

*.asm_diskstring='/dev/asmdisk*'
*.large_pool_size=12M
*.remote_login_passwordfile='EXCLUSIVE'
~
~
~
~
~
~
"init+ASM.ora" [New] 4L, 96C written
[root@testdb01 dbs]#

[root@testdb01 dbs]# cd ../bin
[root@testdb01 bin]# ./srvctl add asm
[root@testdb01 bin]# 
[root@testdb01 bin]# ./crsctl modify resource "ora.asm" -attr "AUTO_START=1" 
CRS-4995: The command 'Modify resource' is invalid in crsctl. Use srvctl for this command.
[root@testdb01 bin]# pwd
/oracle/app/oracle/product/12.1.0/grid/bin
[root@testdb01 bin]# 
[root@testdb01 ~]# . oraenv
ORACLE_SID = [root] ? +ASM
The Oracle base has been set to /oracle/app/oracle
[root@testdb01 ~]# export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/grid
[root@testdb01 ~]# cd /oracle/app/oracle/product/12.1.0/grid/bin
[root@testdb01 bin]# ./srvctl start asm

[root@testdb01 bin]# ./crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details 
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
 ONLINE ONLINE testdb01 STABLE
ora.asm
 ONLINE ONLINE testdb01 Started,STABLE
ora.ons
 OFFLINE OFFLINE testdb01 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
 1 ONLINE ONLINE testdb01 STABLE
ora.diskmon
 1 OFFLINE OFFLINE STABLE
ora.evmd
 1 ONLINE ONLINE testdb01 STABLE
--------------------------------------------------------------------------------
[root@testdb01 bin]# ps -ef | grep pmon

oracle 4208 1 0 15:01 ? 00:00:00 asm_pmon_+ASM
root 4265 4093 0 15:02 pts/4 00:00:00 grep --color=auto pmon
[root@testdb01 bin]# 
[root@testdb01 bin]# kfod asm_diskstring='/dev/asmdisk*' disks=all
--------------------------------------------------------------------------------
 Disk Size Path User Group 
================================================================================
 1: 102399 Mb /dev/asmdisk01 oracle dba 
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME 
================================================================================
 +ASM /oracle/app/oracle/product/12.1.0/grid 
[root@testdb01 bin]# ^C
[root@testdb01 bin]# logout
[oracle@testdb01 bin]$ export ORACLE_SID=+ASM
[oracle@testdb01 bin]$ cd /oracle/app/oracle/product/12.1.0/grid
[oracle@testdb01 grid]$ export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/grid
[oracle@testdb01 grid]$ sqlplus / as sysasm

SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 9 15:03:56 2017

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option

SQL> show parameter asm

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string /dev/asmdisk*
asm_power_limit integer 1
asm_preferred_read_failure_groups string
SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
/dev/asmdisk01

SQL> create spfile from pfile;

File created.

SQL> show parameter asm

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string /dev/asmdisk*
asm_power_limit integer 1
asm_preferred_read_failure_groups string
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option
[oracle@testdb01 grid]$ asmcmd
ASMCMD> ls
ASMCMD> 
ASMCMD> exit
[oracle@testdb01 grid]$ cd dbs
[oracle@testdb01 dbs]$ ls -la
total 28
drwxr-xr-x. 2 oracle oinstall 4096 Aug 9 15:04 .
drwxr-x---. 78 root oinstall 4096 Aug 9 10:49 ..
-rw-rw---- 1 oracle oinstall 2827 Aug 9 15:01 ab_+ASM.dat
-rw-rw----. 1 oracle oinstall 1544 Aug 9 15:01 hc_+ASM.dat
-rw-r--r-- 1 root root 96 Aug 9 14:57 init+ASM.ora
-rw-r--r--. 1 oracle oinstall 2992 Feb 3 2012 init.ora
-rw-r----- 1 oracle oinstall 1536 Aug 9 15:04 spfile+ASM.ora
[oracle@testdb01 dbs]$ pwd
/oracle/app/oracle/product/12.1.0/grid/dbs
[oracle@testdb01 dbs]$ cd ..
[oracle@testdb01 grid]$ cd bin
[oracle@testdb01 bin]$ ./srvctl modify asm -p "/oracle/app/oracle/product/12.1.0/grid/dbs/spfile+ASM.ora"
[oracle@testdb01 bin]$ ./srvctl modify asm -l LISTENER
[oracle@testdb01 bin]$ ./crsctl stat res -t

[oracle@testdb01 bin]$ 
[oracle@testdb01 bin]$ ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[oracle@testdb01 bin]$ 
[oracle@testdb01 bin]$ 
[oracle@testdb01 bin]$ ps -ef | grep pmon
oracle 4780 1 0 15:09 ? 00:00:00 asm_pmon_+ASM
oracle 4890 1567 0 15:11 pts/4 00:00:00 grep --color=auto pmon
[oracle@testdb01 bin]$ ./crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details 
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
 ONLINE ONLINE testdb01 STABLE
ora.asm
 ONLINE ONLINE testdb01 Started,STABLE
ora.ons
 OFFLINE OFFLINE testdb01 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
 1 ONLINE ONLINE testdb01 STABLE
ora.diskmon
 1 OFFLINE OFFLINE STABLE
ora.evmd
 1 ONLINE ONLINE testdb01 STABLE
--------------------------------------------------------------------------------

[oracle@testdb01 bin]$ sqlplus / as sysasm

SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 9 15:13:43 2017

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option



SQL> SELECT STATE, NAME FROM V$ASM_DISKGROUP;

STATE NAME
----------- ------------------------------
DISMOUNTED DATA01

SQL> alter diskgroup DATA01 mount;

Diskgroup altered.

SQL> SELECT STATE, NAME FROM V$ASM_DISKGROUP;SQL> SELECT STATE, NAME FROM V$ASM_DISKGROUP;
STATE       NAME----------- ------------------------------MOUNTED     DATA01
SQL> select name,total_mb/1024 as total_gb,trunc(cold_used_mb/1024) as used_gb, ROUND(free_mb/1024) as free_gb from v$asm_diskgroup;
NAME                             TOTAL_GB    USED_GB    FREE_GB------------------------------ ---------- ---------- ----------DATA01                       99.9990234          8        92
SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit ProductionWith the Automatic Storage Management option

[oracle@testdb01 bin]$ . oraenv

ORACLE_SID = [+ASM] ? TESTDB

The Oracle base remains unchanged with value /oracle/app/oracle

[oracle@testdb01 bin]$ export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/dbhome_1

[oracle@testdb01 bin]$ export ORACLE_SID=TESTDB

[oracle@testdb01 bin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 9 15:16:45 2017

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+FBDATA01/TESTDB/spfileTESTDB.ora'
ORA-17503: ksfdopn:10 Failed to open file +FBDATA01/TESTDB/spfileTESTDB.ora
ORA-15173: entry 'spfileTESTDB.ora' does not exist in directory 'TESTDB'
ORA-06512: at line 4
SQL> exit

Disconnected
[oracle@testdb01 bin]$ cd /oracle/app/oracle/product/12.1.0/dbhome_1/dbs
[oracle@testdb01 dbs]$ ls -la
total 17780
drwxr-xr-x. 2 oracle oinstall 4096 Aug 9 11:24 .
drwxr-xr-x. 75 oracle oinstall 4096 Aug 9 10:45 ..
-rw-rw----. 1 oracle oinstall 1544 Aug 9 13:25 hc_TESTDB.dat
-rw-r-----. 1 oracle oinstall 47 Feb 17 2016 initTESTDB.ora
-rw-r--r--. 1 oracle oinstall 2992 Feb 3 2012 init.ora
-rw-r-----. 1 oracle oinstall 24 Feb 17 2016 lkTESTDB
-rw-r-----. 1 oracle oinstall 7680 Feb 17 2016 orapwTESTDB
-rw-r----- 1 oracle oinstall 18169856 Aug 9 10:08 snapcf_TESTDB.f
[oracle@testdb01 dbs]$ cat initTESTDB.ora
SPFILE='+DATA01/TESTDB/spfileTESTDB.ora'
[oracle@testdb01 dbs]$ . oraenv
ORACLE_SID = [TESTDB] ? +ASM
The Oracle base remains unchanged with value /oracle/app/oracle
[oracle@testdb01 dbs]$ asmcmd

ASMCMD> ls
DATA01/
ASMCMD> cd DATA01
ASMCMD> ls
ASM/
TESTDB/
orapwasm
ASMCMD> cd TESTDB
ASMCMD> ls
ARCHIVELOG/
AUTOBACKUP/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
ASMCMD> cd PARAMETERFILE
ASMCMD> ls
spfile.273.904067065
ASMCMD> exit
[oracle@testdb01 dbs]$ vi initTESTDB.ora
SPFILE='+DATA01/TESTDB/PARAMETERFILE/spfile.273.904067065'
~
~
~
~
~
"initTESTDB.ora" 1L, 63C written
[oracle@testdb01 dbs]$

[oracle@testdb01 dbs]$ cat initTESTDB.ora
SPFILE='+DATA01/TESTDB/PARAMETERFILE/spfile.273.904067065'
[oracle@testdb01 dbs]$ . oraenv
ORACLE_SID = [+ASM] ? TESTDB
The Oracle base remains unchanged with value /oracle/app/oracle
[oracle@testdb01 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 9 15:20:41 2017

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 8405385216 bytes
Fixed Size 2944416 bytes
Variable Size 4127195744 bytes
Database Buffers 4261412864 bytes
Redo Buffers 13832192 bytes
Database mounted.
Database opened.
SQL> exit