miércoles, 9 de marzo de 2016

Como Desinstalar Oracle Grid Infrastructure 12c

Para desintalar todo que implica deconfigurar los nodos, eliminar las instancias de ASM y deinstalar el software de grid se ejecuta un script :  $ORACLE_HOME/deinstall/deinstall con el usuario oracle dueño del $ORACLE_HOME del grid.
En este ejempo tengo un cluster de 2 nodos (rac1 y rac2) con Oracle Grid Infrastructure 12c instalado y levantado. En este ambiente el listener levantado es el default LISTENER y el objetivo es borrar todo incluido diskgroups. El usuario en este ejemplo es oracle porque se instalo el software de grid con oracle, pero podria ser grid si se instala con grid.
Mis comentarios estan en AZUL.

Me logueo con usuario oracle y verifico en rac1:
[oracle@rac1 grid]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online

Verifico en rac2:
[oracle@rac2 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online


Estan las instancias de ASM y la de -MGMTDB levantadas: 
[oracle@rac1 grid]$ ps -ef| grep pmon
oracle   11164     1  0 08:41 ?        00:00:00 asm_pmon_+ASM1
oracle   11816     1  0 08:43 ?        00:00:00 mdb_pmon_-MGMTDB
oracle   16438  6356  0 08:58 pts/0    00:00:00 grep pmon

[oracle@rac2 ~]$ ps -ef | grep pmon
oracle    3830     1  0 08:25 ?        00:00:00 asm_pmon_+ASM2
oracle   14916  5956  0 09:00 pts/0    00:00:00 grep pmon

Aclaracion : -MGMTDB levanta en uno solo de los nodos.

Para Desinstalar :
[oracle@rac1 grid]$ cd $ORACLE_HOME
[oracle@rac1 grid]$ cd deinstall
[oracle@rac1 deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
--->> DEMORA VARIOS MINUTOS!

Location of logs /tmp/deinstall2016-03-09_09-04-36AM/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/12.1.0/grid
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Cluster
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/12.1.0/grid
The following nodes are part of this cluster: rac1,rac2
Active Remote Nodes are rac2
Checking for sufficient temp space availability on node(s) : 'rac1,rac2'

## [END] Install check configuration ##

Traces log file: /tmp/deinstall2016-03-09_09-04-36AM/logs//crsdc_2016-03-09_09-17-22AM.log

Network Configuration check config START

Network de-configuration trace file location: /tmp/deinstall2016-03-09_09-04-36AM/logs/netdc_check2016-03-09_09-17-29-AM.log

Specify all RAC listeners (do not include SCAN listener) that are to be de-configured. Enter .(dot) to deselect all. [LISTENER]:  ENTER
Network Configuration check config END

Asm Check Configuration START

ASM de-configuration trace file location: /tmp/deinstall2016-03-09_09-04-36AM/logs/asmcadc_check2016-03-09_11-45-13-AM.log

Automatic Storage Management (ASM) instance is detected in this Oracle home /u01/app/12.1.0/grid.
ASM Diagnostic Destination : /u01/app/oracle
ASM Diskgroups : +DATA
ASM diskstring : /dev/oracleasm/disks
Diskgroups will be dropped
De-configuring ASM will drop all the diskgroups and their contents at cleanup time. This will affect all of the databases and ACFS that use this ASM instance(s).

 If you want to retain the existing diskgroups or if any of the information detected is incorrect, you can modify by entering 'y'. Do you  want to modify above information (y|n) [n]:ENTER 
Database Check Configuration START

Database de-configuration trace file location: /tmp/deinstall2016-03-09_08-12-04PM/logs/databasedc_check2016-03-09_08-31-37-PM.log

Oracle Grid Management database was found in this Grid Infrastructure home

Database Check Configuration END

######################### DECONFIG CHECK OPERATION END #########################


####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/12.1.0/grid
The following nodes are part of this cluster: rac1,rac2
Active Remote Nodes are rac2
The cluster node(s) on which the Oracle home deinstallation will be performed are:rac1,rac2
Oracle Home selected for deinstall is: /u01/app/12.1.0/grid
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Following RAC listener(s) will be de-configured: LISTENER
ASM instance will be de-configured from this Oracle home
Oracle Grid Management database was found in this Grid Infrastructure home
Oracle Grid Management database will be de-configured from this Grid Infrastructure home

Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/tmp/deinstall2016-03-09_08-12-04PM/logs/deinstall_deconfig2016-03-09_08-22-59-PM.out'
Any error messages from this session will be written to: '/tmp/deinstall2016-03-09_08-12-04PM/logs/deinstall_deconfig2016-03-09_08-22-59-PM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /tmp/deinstall2016-03-09_08-12-04PM/logs/databasedc_clean2016-03-09_08-33-09-PM.log

This operation may take few minutes.
--->> DEMORA VARIOS MINUTOS!
ASM de-configuration trace file location: /tmp/deinstall2016-03-09_08-12-04PM/logs/asmcadc_clean2016-03-09_08-42-54-PM.log
ASM Clean Configuration START
ASM Clean Configuration END

Network Configuration clean config START

Network de-configuration trace file location: /tmp/deinstall2016-03-09_08-12-04PM/logs/netdc_clean2016-03-09_08-43-14-PM.log

De-configuring RAC listener(s): LISTENER

De-configuring listener: LISTENER
    Stopping listener: LISTENER
    Listener stopped successfully.
    Unregistering listener: LISTENER
    Listener unregistered successfully.
Listener de-configured successfully.

De-configuring Naming Methods configuration file on all nodes...
Naming Methods configuration file de-configured successfully.

De-configuring Local Net Service Names configuration file on all nodes...
Local Net Service Names configuration file de-configured successfully.

De-configuring Directory Usage configuration file on all nodes...
Directory Usage configuration file de-configured successfully.


De-configuring backup files on all nodes...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.

Network Configuration clean config END

---------------------------------------->

The deconfig command below can be executed in parallel on all the remote nodes. Execute the command on  the local node after the execution completes on all the remote nodes.

Run the following command as the root user or the administrator on node "rac2".

/tmp/deinstall2016-03-09_08-12-04PM/perl/bin/perl -I/tmp/deinstall2016-03-09_08-12-04PM/perl/lib -I/tmp/deinstall2016-03-09_08-12-04PM/crs/install /tmp/deinstall2016-03-09_08-12-04PM/crs/install/rootcrs.pl -force  -deconfig -paramfile "/tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_OraGI12Home1.rsp"

Run the following command as the root user or the administrator on node "rac1".

/tmp/deinstall2016-03-09_08-12-04PM/perl/bin/perl -I/tmp/deinstall2016-03-09_08-12-04PM/perl/lib -I/tmp/deinstall2016-03-09_08-12-04PM/crs/install /tmp/deinstall2016-03-09_08-12-04PM/crs/install/rootcrs.pl -force  -deconfig -paramfile "/tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_OraGI12Home1.rsp" -lastnode

Press Enter after you finish running the above commands

<----------------------------------------


--->> SIN CERRAR ESTA TERMINAL, ABRIR OTRA TERMINAL y EJECUTAR EL SCRIPT QUE GENERO AUTOMATICAMENTE (MARCADO EN ROJO ARRIBA):
[oracle@rac1 ~]$ ssh root@rac2
root@rac2's password: 
Last login: Tue Feb 16 23:00:51 2016 from rac1.localdomain
[root@rac2 ~]# /tmp/deinstall2016-03-09_08-12-04PM/perl/bin/perl -I/tmp/deinstall2016-03-09_08-12-04PM/perl/lib -I/tmp/deinstall2016-03-09_08-12-04PM/crs/install /tmp/deinstall2016-03-09_08-12-04PM/crs/install/rootcrs.pl -force  -deconfig -paramfile "/tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_OraGI12Home1.rsp"


Using configuration parameter file: /tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_OraGI12Home1.rsp
Network 1 exists
Subnet IPv4: 192.168.56.0/255.255.255.0/eth0, static
Subnet IPv6: 
Ping Targets: 
Network is enabled
Network is individually enabled on nodes: 
Network is individually disabled on nodes: 
VIP exists: network number 1, hosting node rac1
VIP Name: rac1-vip.localdomain
VIP IPv4 Address: 192.168.56.81
VIP IPv6 Address: 
VIP is enabled.
VIP is individually enabled on nodes: 
VIP is individually disabled on nodes: 
VIP exists: network number 1, hosting node rac2
VIP Name: rac2-vip.localdomain
VIP IPv4 Address: 192.168.56.82
VIP IPv6 Address: 
VIP is enabled.
VIP is individually enabled on nodes: 
VIP is individually disabled on nodes: 
ONS exists: Local port 6100, remote port 6200, EM port 2016, Uses SSL false
ONS is enabled
ONS is individually enabled on nodes: 
ONS is individually disabled on nodes: 
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac2'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac2'
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'rac2'
CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'rac2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac2' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac2'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac2'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac2'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac2'
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac2' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac2'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac2'
CRS-2677: Stop of 'ora.ctssd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac2'
CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac2'
CRS-2677: Stop of 'ora.crf' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac2'
CRS-2677: Stop of 'ora.gipcd' on 'rac2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
2016/03/10 01:04:04 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.

2016/03/10 01:04:30 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.

2016/03/10 01:04:36 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node

2016/03/10 01:04:43 CLSRSC-46: Error: '/u01/app/oracle/crsdata/rac2/crsconfig/cluutil2.log' does not exist

2016/03/10 01:04:43 CLSRSC-46: Error: '/u01/app/oracle/crsdata/rac2/crsconfig/cluutil2.log' does not exist

[root@rac2 ~]# 

--->Estos 2 Errores al tratar de escribir el log son un BUG que no afecta la desinstalacion. IGNORARLOS.
VOLVER A RAC1 EN ESA TERMINAL y EJECUTAR EL SCRIPT QUE GENERO AUTOMATICAMENTE  (MARCADO EN ROJO ARRIBA):
[root@rac2 ~]# exit
logout
Connection to rac2 closed.
[oracle@rac1 ~]$ su - root
Password: 
[root@rac1 ~]# /tmp/deinstall2016-03-09_08-12-04PM/perl/bin/perl -I/tmp/deinstall2016-03-09_08-12-04PM/perl/lib -I/tmp/deinstall2016-03-09_08-12-04PM/crs/install /tmp/deinstall2016-03-09_08-12-04PM/crs/install/rootcrs.pl -force  -deconfig -paramfile "/tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_OraGI12Home1.rsp" -lastnode
Using configuration parameter file: /tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_OraGI12Home1.rsp
Network 1 exists
Subnet IPv4: 192.168.56.0/255.255.255.0/eth0, static
Subnet IPv6: 
Ping Targets: 
Network is enabled
Network is individually enabled on nodes: 
Network is individually disabled on nodes: 
VIP exists: network number 1, hosting node rac1
VIP Name: rac1-vip.localdomain
VIP IPv4 Address: 192.168.56.81
VIP IPv6 Address: 
VIP is enabled.
VIP is individually enabled on nodes: 
VIP is individually disabled on nodes: 
ONS exists: Local port 6100, remote port 6200, EM port 2016, Uses SSL false
ONS is enabled
ONS is individually enabled on nodes: 
ONS is individually disabled on nodes: 
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2673: Attempting to stop 'ora.MGMTLSNR' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'rac1'
CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'rac1' succeeded
CRS-2677: Stop of 'ora.MGMTLSNR' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac1'
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.evmd' on 'rac1'
CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'
CRS-2676: Start of 'ora.evmd' on 'rac1' succeeded
CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'
CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'
CRS-2672: Attempting to start 'ora.gipcd' on 'rac1'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'
CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded
ASM de-configuration trace file location: /tmp/deinstall2016-03-09_08-12-04PM/logs/asmcadc_clean2016-03-10_01-14-42-AM.log
ASM Clean Configuration START
ASM Clean Configuration END

ASM with SID +ASM1 deleted successfully. Check /tmp/deinstall2016-03-09_08-12-04PM/logs/asmcadc_clean2016-03-10_01-14-42-AM.log for details.

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac1'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
2016/03/10 01:19:23 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.

2016/03/10 01:19:44 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.

2016/03/10 01:19:48 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node

2016/03/10 01:19:48 CLSRSC-559: Ensure that the GPnP profile data under the 'gpnp' directory in /u01/app/12.1.0/grid is deleted on each node before using the software in the current Grid Infrastructure home for reconfiguration.

2016/03/10 01:19:55 CLSRSC-46: Error: '/u01/app/oracle/crsdata/rac1/crsconfig/cluutil2.log' does not exist

2016/03/10 01:19:56 CLSRSC-46: Error: '/u01/app/oracle/crsdata/rac1/crsconfig/cluutil2.log' does not exist

[root@rac1 ~]# 

---> Estos 2 Errores al tratar de escribir el log son un BUG que no afecta la desinstalacion. IGNORARLOS.
VOLVER A LA TERMINAL DONDE SE EJECUTO EL ./deinstall
...................................
Press Enter after you finish running the above commands

<----------------------------------------
ENTER

######################### DECONFIG CLEAN OPERATION END #########################


####################### DECONFIG CLEAN OPERATION SUMMARY #######################
Successfully de-configured Oracle Grid Management database
ASM instance was de-configured successfully from the Oracle home
Following RAC listener(s) were de-configured successfully: LISTENER
Oracle Clusterware is stopped and successfully de-configured on node "rac1"
Oracle Clusterware is stopped and successfully de-configured on node "rac2"
Oracle Clusterware is stopped and de-configured successfully.
#######################################################################


############# ORACLE DECONFIG TOOL END #############

Using properties file /tmp/deinstall2016-03-09_08-12-04PM/response/deinstall_2016-03-09_08-22-59-PM.rsp
Location of logs /tmp/deinstall2016-03-09_08-12-04PM/logs/

############ ORACLE DEINSTALL TOOL START ############





####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/tmp/deinstall2016-03-09_08-12-04PM/logs/deinstall_deconfig2016-03-09_08-22-59-PM.out'
Any error messages from this session will be written to: '/tmp/deinstall2016-03-09_08-12-04PM/logs/deinstall_deconfig2016-03-09_08-22-59-PM.err'

######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to rac1
Setting REMOTE_NODES to rac2
Setting CLUSTER_NODES to rac1,rac2
Setting CRS_HOME to true
Setting oracle.installer.invPtrLoc to /tmp/deinstall2016-03-09_08-12-04PM/oraInst.loc
Setting oracle.installer.local to false

## [END] Preparing for Deinstall ##

Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START
Detach Oracle home '/u01/app/12.1.0/grid' from the central inventory on the local node : Done

Delete directory '/u01/app/12.1.0/grid' on the local node : Done

Delete directory '/u01/app/oraInventory' on the local node : Done

Delete directory '/u01/app/oracle' on the local node : Done

Detach Oracle home '/u01/app/12.1.0/grid' from the central inventory on the remote nodes 'rac2' : Done

Delete directory '/u01/app/12.1.0/grid' on the remote nodes 'rac2' : Done

Delete directory '/u01/app/oraInventory' on the remote nodes 'rac2' : Done

Successfully deleted directory '/u01/app/oracle' on the local node.
Successfully detached Oracle home '/u01/app/12.1.0/grid' from the central inventory on the remote nodes 'rac2'.
Successfully deleted directory '/u01/app/12.1.0/grid' on the remote nodes 'rac2'.
Successfully deleted directory '/u01/app/oraInventory' on the remote nodes 'rac2'.
Oracle Universal Installer cleanup was successful.


Run 'rm -r /etc/oraInst.loc' as root on node(s) 'rac1,rac2' at the end of the session.

Run 'rm -r /opt/ORCLfmap' as root on node(s) 'rac1,rac2' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL TOOL END #############
[oracle@rac1 deinstall]$

--->EN LA OTRA TERMINAL EJECUTAR LO QUE SOLICTA  (MARCADO EN ROJO ARRIBA):
[root@rac1 ~]# rm -r /etc/oraInst.loc
rm: remove regular file `/etc/oraInst.loc'? y

[root@rac1 ~]# rm -r /opt/ORCLfmap
rm: descend into directory `/opt/ORCLfmap'? y
rm: descend into directory `/opt/ORCLfmap/prot1_64'? y
rm: descend into directory `/opt/ORCLfmap/prot1_64/etc'? y
rm: remove regular file `/opt/ORCLfmap/prot1_64/etc/filemap.ora'? y
rm: remove directory `/opt/ORCLfmap/prot1_64/etc'? y
rm: descend into directory `/opt/ORCLfmap/prot1_64/bin'? y
rm: remove regular file `/opt/ORCLfmap/prot1_64/bin/fmputlhp'? y
rm: remove regular file `/opt/ORCLfmap/prot1_64/bin/fmputl'? y
rm: remove directory `/opt/ORCLfmap/prot1_64/bin'? y
rm: remove directory `/opt/ORCLfmap/prot1_64/log'? y
rm: remove directory `/opt/ORCLfmap/prot1_64'? y
rm: remove directory `/opt/ORCLfmap'? y


[root@rac1 ~]# ssh root@rac2
root@rac2's password: 
Last login: Thu Mar 10 01:01:19 2016 from rac1.localdomain
[root@rac2 ~]# rm -r /etc/oraInst.loc
rm: remove regular file `/etc/oraInst.loc'? y

[root@rac2 ~]# rm -r /opt/ORCLfmap
rm: descend into directory `/opt/ORCLfmap'? y
rm: descend into directory `/opt/ORCLfmap/prot1_64'? y
rm: descend into directory `/opt/ORCLfmap/prot1_64/etc'? y
rm: remove regular file `/opt/ORCLfmap/prot1_64/etc/filemap.ora'? y
rm: remove directory `/opt/ORCLfmap/prot1_64/etc'? y
rm: descend into directory `/opt/ORCLfmap/prot1_64/bin'? y
rm: remove regular file `/opt/ORCLfmap/prot1_64/bin/fmputlhp'? y
rm: remove regular file `/opt/ORCLfmap/prot1_64/bin/fmputl'? y
rm: remove directory `/opt/ORCLfmap/prot1_64/bin'? y
rm: remove directory `/opt/ORCLfmap/prot1_64/log'? y
rm: remove directory `/opt/ORCLfmap/prot1_64'? y
rm: remove directory `/opt/ORCLfmap'? y
[root@rac2 ~]# 


[oracle@rac1 deinstall]$ pwd
/u01/app/12.1.0/grid/deinstall
[oracle@rac1 deinstall]$ ls -l
total 0
[oracle@rac1 deinstall]$ cd ..
cd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
[oracle@rac1 ..]$ 

DESINTALACION FINALIZADA! 

Verificamos que desinstalo el soft en rac1:
[oracle@rac1 deinstall]$ pwd
/u01/app/12.1.0/grid/deinstall
[oracle@rac1 deinstall]$ ls -l
total 0
[oracle@rac1 deinstall]$ cd ..
cd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
[oracle@rac1 ..]$ cd /u01/app
[oracle@rac1 app]$ ls -l
total 4
drwxr-xr-x. 2 oracle oinstall 4096 Mar 10 01:25 12.1.0
[oracle@rac1 app]$ cd 12.1.0
[oracle@rac1 12.1.0]$ ls -l
total 0
[oracle@rac1 12.1.0]$ 


Verificamos que desinstalo el soft en rac2:
[oracle@rac1 ~]$ ssh rac2
Last login: Thu Mar 10 01:00:30 2016 from rac1.localdomain
[oracle@rac2 ~]$ cd /u01/app/12.1.0
[oracle@rac2 12.1.0]$ ls -l
total 0






martes, 6 de octubre de 2015

Statspack : Liberar Espacio Recreandolo

Cuando tomamos estadisticas con STATSPACK si no tenemos la precaucion de ir depurando (Ver en mi blog como DEPURAR) va a ir creciendo la cantidad de estadisticas y por mas que despues depuremos tendriamos que liberar el espacio.
Un metodo rapido para liberar espacio del tablespace PERFSTAT si es que no necesitamos conservar las estadisticas historicas es re.crearlo.


1 - Borrar todo el Statspack
SQL> @?/rdbms/admin/spdrop

2 - Eliminar el Tablespace
SQL> drop tablespace perfstat including contents;

3 - Eliminar los Datafiles
/u01/oradata/ORCL>rm perfstat01.dbf
/u01/oradata/ORCL>rm perfstat02.dbf

4 - Recrear tablespace
SQL> create tablespace PERFSTAT datafile '/u01/oradata/ORCL/perfstat01.dbf' size 2048M;

5 - Para recrearlo, ejecutar spcreate. Nos va a pedir que ingresemos : password para el ususario PERFSTAT, Tablespace Default y Temporary Tablespace
SQL> @?/rdbms/admin/spcreate

Choose the PERFSTAT user's password
-----------------------------------
Not specifying a password will result in the installation FAILING

Enter value for perfstat_password: perfstat

Choose the Default tablespace for the PERFSTAT user
---------------------------------------------------
Below is the list of online tablespaces in this database which can
store user data.  Specifying the SYSTEM tablespace for the user's
default tablespace will result in the installation FAILING, as
using SYSTEM for performance data is not supported.

Choose the PERFSTAT users's default tablespace.  This is the tablespace
in which the STATSPACK tables and indexes will be created.

TABLESPACE_NAME                CONTENTS  STATSPACK DEFAULT TABLESPACE
------------------------------ --------- ----------------------------
PERFSTAT                      PERMANENT
SYSAUX                          PERMANENT *
UNDO                              PERMANENT
USERS                             PERMANENT

Pressing <return> will result in STATSPACK's recommended default
tablespace (identified by *) being used.

Enter value for default_tablespace: PERFSTAT

Choose the Temporary tablespace for the PERFSTAT user
-----------------------------------------------------
Below is the list of online tablespaces in this database which can
store temporary data (e.g. for sort workareas).  Specifying the SYSTEM
tablespace for the user's temporary tablespace will result in the
installation FAILING, as using SYSTEM for workareas is not supported.

Choose the PERFSTAT user's Temporary tablespace.

TABLESPACE_NAME                CONTENTS  DB DEFAULT TEMP TABLESPACE
------------------------------ --------- --------------------------
TEMP                           TEMPORARY *

Pressing <return> will result in the database's default Temporary
tablespace (identified by *) being used.

Enter value for temporary_tablespace: TEMP

.............................................................
Creating Package STATSPACK...

Package created.

No errors.
Creating Package Body STATSPACK...

Package body created.

No errors.

NOTE:
SPCPKG complete. Please check spcpkg.lis for any errors.

SQL>


Listo!











viernes, 2 de octubre de 2015

Scripts Para Depurar Snapshots Statspack

Scripts para depurar un rango de snapshots dejando las estadisticas de los ultimos 30 dias. Se recomienda ejecutar diariamente.


depura_statspack.sh
#!/bin/bash
################################################
# Depura las estadisticas del statspack dejando los ultimos 30 dias.  
#
#################################################

source ~/.bash_profile
sqlplus perfstat/perfstat @$HOME/scripts/depura_statspack.sql
exit



____________________________________________________________

depura_statspack.sql
spool /home/oracle/logs/depura_statspack.log
col menor format 999999 new_value losnapid
col mayor format 999999 new_value hisnapid
select min(snap_id) as menor, max(snap_id) as mayor from  stats$snapshot
where snap_time < sysdate - 30;
@?/rdbms/admin/sppurge
spool off
exit




lunes, 7 de septiembre de 2015

SP2-0613: Unable to verify PLAN_TABLE format or existence

Al intentar habilitar el AUTOTRACE puede dar ese error 

SQL> set autotrace traceonly  
SP2-0613: Unable to verify PLAN_TABLE format or existence
SP2-0611: Error enabling EXPLAIN report

Eso es debido a que no existe la PLAN_TABLE en el esquema del usuario que estamos conectados.

Para solucionarlo ejecutar:
SQL> @?/rdbms/admin/utlxplan
Table created.


Luego :
SQL> set autotrace traceonly

Listo!

miércoles, 10 de junio de 2015

Como Migrar los SQL PROFILES de una Base a Otra

Cuando tenemos que migrar los sql profiles de una base de datos a otra, por ej los generados en Testing a Produccion debemos realizar los siguientes pasos
1 - En la Base Origen ; Verificar cuantos sql_profiles tenemos
select count(*) from dba_sql_profiles;

2 - Crear una Staging Table
Esta tabla no la podemos crear en SYS, en este ejemplo esta en SYSTEM, pero se puede usar cualquier usuario
sqlplus / as sysdba
SQL> BEGIN
DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF
(table_name => ‘TAB_SQL_PROFILES’,schema_name=>’SYSTEM’);
     END;
/

3. Copiar los SQL PROFILES a la Staging Table
SQL> BEGIN
DBMS_SQLTUNE.PACK_STGTAB_SQLPROF
(profile_category => ‘%’,
staging_table_name => ‘TAB_SQL_PROFILES’,
staging_schema_owner=>’SYSTEM’);
END;
/

4. Verificar
 select count(*) from SYSTEM.TAB_SQL_PROFILES;

5 . Exportar los SQL PROFILES
expdp system/***** dumpfile=expdp_sql_profiles.dmp TABLES=SYSTEM.TAB_SQL_PROFILES
DIRECTORY=DATA_PUMP_DIR

(Verificar donde apunta el directorio select * from dba_directories;)

6. Transferir el dump al servidor de la Base Destino

7. En la Base Destino : Crear la Staging Table
sqlplus / as sysdba
SQL> BEGIN
DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF
(table_name => ‘TAB_SQL_PROFILES’,schema_name=>’SYSTEM’);
     END;
/

8. Importar los SQL PROFILE, con TABLE_EXISTS_ACTION=TRUNCATE, esto implica que si la tabla existe ejecuta el truncate y la carga con los datos del dump

impdp system/***** dumpfile=expdp_sql_profiles.dmp TABLES=SYSTEM.TAB_SQL_PROFILES DIRECTORY=DATA_PUMP_DIR TABLE_EXISTS_ACTION=TRUNCATE

9. Verificar que se importaron
select count(*) from SYSTEM.TAB_SQL_PROFILES;

10. Verificar cuantos SQL PROFILES hay antes de desempaquetar
select count(*) from dba_sql_profiles;

11. Desempaquetar
SQL> BEGIN
DBMS_SQLTUNE.UNPACK_STGTAB_SQLPROF
(staging_table_name => ‘TAB_SQL_PROFILES’,
staging_schema_owner=>’SYSTEM’, replace=>FALSE);

12. Verificar que se agregaron bien los profiles. Tiene que dar el valor del resultado que dio el punto 10 + el punto 11, salvo que ya existiera previamente alguno de los profiles en ese caso puede dar menos.
select count(*) from dba_sql_profiles;




martes, 7 de abril de 2015

Statspack : Como depurar snapshots

Si estas trabajando con versiones de Oracle anteriores a 10g o no tenes el diagnostic pack, seguramente seguis usando statspacks.
Con el tiempo los snapshots se van acumulando y se hace necesario depurar.
Para depurar se ejecuta sppurge.sql, lista todos los snapshots que hay y nos va a requerir el Lo Snap ID que es el valor de snapshot desde el cual se quiere depurar y el Hi Snap ID que es el valor de snapshot hasta el cual se quiere depurar. Depura todos los snapshots identificados entre esos valores, hay que tener en cuenta al seleccionar los snapshots a depurar que este comando no tiene vuelta atras. 

SQL> connect perfstat/perfstat
Connected.

SQL> @$ORACLE_HOME/rdbms/admin/sppurge


     230  14 Jan 2015 19:10:01           5 s021
     231  14 Jan 2015 20:10:01           5 s021
     232  14 Jan 2015 21:10:02           5 s021
     233  14 Jan 2015 22:10:01           5 s021
     234  14 Jan 2015 23:10:01           5 s021
     235  15 Jan 2015 00:10:02           5 s021
     236  15 Jan 2015 01:10:01           5 s021
     237  15 Jan 2015 02:10:01           5 s021
     238  15 Jan 2015 03:10:01           5 s021
     239  15 Jan 2015 04:10:01           5 s021
     240  15 Jan 2015 05:10:01           5 s021
     241  15 Jan 2015 06:10:01           5 s021
     242  15 Jan 2015 07:10:01           5 s021
     243  15 Jan 2015 08:10:02           5 s021
     244  15 Jan 2015 09:10:01           5 s021
     245  15 Jan 2015 10:10:01           5 s021
     246  15 Jan 2015 11:10:02           5 s021
     247  15 Jan 2015 12:10:01           5 s021
     248  15 Jan 2015 13:10:01           5 s021
     249  15 Jan 2015 14:10:02           5 s021
     250  15 Jan 2015 15:10:01           5 s021
     251  15 Jan 2015 16:10:01           5 s021
     252  15 Jan 2015 17:10:01           5 s021


Warning
~~~~~~~
sppurge.sql deletes all snapshots ranging between the lower and
upper bound Snapshot Id's specified, for the database instance
you are connected to.  Snapshots identified as Baseline snapshots
which lie within the snapshot range will not be purged.

It is NOT possible to rollback changes once the purge begins.

You may wish to export this data before continuing.


Specify the Lo Snap Id and Hi Snap Id range to purge
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for losnapid: 230
Using 230 for lower bound.

Enter value for hisnapid: 252
Using 252 for upper bound.

Deleting snapshots 230 - 252.

Number of Snapshots purged: 23
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Purge of specified Snapshot range complete.


SQL> exit

jueves, 12 de marzo de 2015

Como verificar que opciones (Oracle Options) estan instaladas en la Base de Datos

Para verificar que opciones (Oracle Options) estan instaladas en la Base de Datos podemos consultar la vista v$option

Ejemplo :
SQL> set pagesize 1000
SQL> col parameter format a40
SQL> col value format a20
SQL> select * from v$option;

PARAMETER                                VALUE
---------------------------------------- --------------------
Partitioning                             FALSE
Objects                                  TRUE
Real Application Clusters                FALSE
Advanced replication                     FALSE
Bit-mapped indexes                       FALSE
Connection multiplexing                  TRUE
Connection pooling                       TRUE
Database queuing                         TRUE
Incremental backup and recovery          TRUE
Instead-of triggers                      TRUE
Parallel backup and recovery             FALSE
Parallel execution                       FALSE
Parallel load                            TRUE
Point-in-time tablespace recovery        FALSE
Fine-grained access control              FALSE
Proxy authentication/authorization       TRUE
Change Data Capture                      FALSE
Plan Stability                           TRUE
Online Index Build                       FALSE
Coalesce Index                           TRUE
Managed Standby                          FALSE
Materialized view rewrite                FALSE
Materialized view warehouse refresh      FALSE
Database resource manager                FALSE
Spatial                                  FALSE
Automatic Storage Management             FALSE
Export transportable tablespaces         FALSE
Transparent Application Failover         TRUE
Fast-Start Fault Recovery                FALSE
Sample Scan                              TRUE
Duplexed backups                         FALSE
Java                                     TRUE
OLAP Window Functions                    TRUE
Block Media Recovery                     FALSE
Fine-grained Auditing                    FALSE
Application Role                         FALSE
Enterprise User Security                 FALSE
Oracle Data Guard                        FALSE
Oracle Label Security                    FALSE
OLAP                                     FALSE
Basic Compression                        FALSE
Join index                               FALSE
Trial Recovery                           FALSE
Data Mining                              FALSE
Online Redefinition                      FALSE
Streams Capture                          FALSE
File Mapping                             FALSE
Block Change Tracking                    FALSE
Flashback Table                          FALSE
Flashback Database                       FALSE
Transparent Data Encryption              FALSE
Backup Encryption                        FALSE
Unused Block Compression                 FALSE
Oracle Database Vault                    FALSE
Result Cache                             FALSE
SQL Plan Management                      FALSE
SecureFiles Encryption                   FALSE
Real Application Testing                 FALSE
Flashback Data Archive                   FALSE
DICOM                                    TRUE
Active Data Guard                        FALSE
Server Flash Cache                       FALSE
Advanced Compression                     FALSE
XStream                                  FALSE
Deferred Segment Creation                FALSE

65 rows selected.