Share the Knowledge even if it is one verse - You earn the rewards as long as the knowledge from which the people benefit.
Thursday, 28 May 2015
How to configure YUM on Oracle Linux
How to configure YUM on Oracle Enterprise Linux?
This is an example for Enterprise Linux 6:
go to the directory /etc/yum.repos.d and edit the file public-yum-el5.repo
# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-el5.repo
Open the yum configuration file in a text editor:
vi public-yum-el5.repo
Change enabled=0 to enabled=1 from the repository you need.
If you have other Linux installtions, then go to http://public-yum.oracle.com/ for instructions on how to configure the yum repository for other Linux versions.
Now we can try it!
yum list
yum install firefox
Wednesday, 12 November 2014
ORA-04021: timeout occurred while waiting to lock object error while executing catbundle.sql script
ORA-04021: timeout occurred while waiting to lock object error while executing the catbundle.sql script
During the patching process, we need to apply the patch sqls to the database. To apply the patches to the database, we execute
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@catbundle.sql apply PSU
the above script hangs due to locked object and the error is written to the log ORA-04021: timeout occurred while waiting to lock object
This was due to the locked object dbms_advisor (in my case).
Solution:
Restarting the database cleared the locks and the catbundle apply completed in few minutes.
During the patching process, we need to apply the patch sqls to the database. To apply the patches to the database, we execute
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@catbundle.sql apply PSU
the above script hangs due to locked object and the error is written to the log ORA-04021: timeout occurred while waiting to lock object
This was due to the locked object dbms_advisor (in my case).
Solution:
Restarting the database cleared the locks and the catbundle apply completed in few minutes.
Thursday, 6 November 2014
Things to consider before upgrading to 11.2.0.4 from 11.2.0.3 - Part 1
Things to consider before upgrading to 11.2.0.4 from 11.2.0.3
Oracle recommends out-of place upgrade from 11.2.0.3 to 11.2.0.4
At the planning stage of the database and grid Infrastructure upgrade, Download and run the ORAchk utility from Oracle to verify and fix any issues before upgrading the clusterware, ASM and the database.
ORAchk tool is the advanced version of RACcheck tool and Oracle recommends to download the ORAchk tool to verify All the Oracle stack.
To download and more details about the script is in Oracle support
$ ./orachk -u -o pre
Enter upgrade target version (valid versions are 11.2.0.3.0, 11.2.0.4.0, 12.1.0.1.0, 12.1.0.2.0):- 11.2.0.4.0
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/grid?[y/n][y]y
Checking ssh user equivalency settings on all nodes in cluster
Node dev02 is configured for ssh user equivalency for oracle user
Searching for running databases . . . . .
. .
List of running databases registered in OCR
1. rac
2. None of above
Select databases from list for checking best practices. For multiple databases, select 1 for All or comma separated number like 1,2 etc [1-2][1].1
. .
Checking Status of Oracle Software Stack - Clusterware, ASM, RDBMS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-------------------------------------------------------------------------------------------------------
Oracle Stack Status
-------------------------------------------------------------------------------------------------------
Host Name CRS Installed RDBMS Installed CRS UP ASM UP RDBMS UP DB Instance Name
-------------------------------------------------------------------------------------------------------
dev01 Yes Yes Yes Yes Yes rac01
dev02 Yes Yes Yes Yes Yes rac02
-------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
Installed components summary
---------------------------------------------------------------------------------------------------------------------------------
GI_HOME ORACLE_HOME Database Names
---------------------------------------------------------------------------------------------------------------------------------
/u01/app/grid - 11.2.0.3.0 /u01/app/oracle/product/11.2.0/db - 11.2.0.3.0 rac
---------------------------------------------------------------------------------------------------------------------------------
Copying plug-ins
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . .
Checking Grid Infrastructure and RDBMS upgrade readiness to version 112040
Collections and audit checks log file is
/oracle/software/11204_DB/orachk_dev01_rac_110514_175251/log/orachk.log
Checking for prompts in /oracle/.bash_profile on dev01 for oracle user...
Checking for prompts in /oracle/.bash_profile on dev02 for oracle user...
Starting to run orachk in background on dev02
=============================================================
Node name - dev01
=============================================================
Collecting - ASM Diskgroup Attributes
Collecting - ASM initialization parameters
Collecting - Database Parameters for rac database
Collecting - Database Undocumented Parameters for rac database
Collecting - Pre-upgrade File Locations for rac database
Collecting - /proc/cmdline
Collecting - /proc/modules
Collecting - CPU Information
Collecting - DiskFree Information
Collecting - DiskMount Information
Collecting - Kernel parameters
Collecting - Maximum number of semaphore sets on system
Collecting - Maximum number of semaphores on system
Collecting - Maximum number of semaphores per semaphore set
Collecting - Memory Information
Collecting - NUMA Configuration
Collecting - Network Interface Configuration
Collecting - Network Performance
Collecting - Network Service Switch
Collecting - OS Packages
Collecting - OS version
Collecting - Patches for Grid Infrastructure
Collecting - Patches for RDBMS Home
Collecting - number of semaphore operations per semop system call
Data collections completed. Checking best practices on dev01.
--------------------------------------------------------------------------------------
INFO => Real World Network Bandwidth Guidelines
INFO => Important Automatic Storage Management (ASM) Notes and Technical White Papers
INFO => Unattended Installation and Configuration Options
INFO => Be aware of provided optional integrity checks
INFO => Patching Notes by Release
INFO => Prior to Upgrade Verify NO Materialized Views Being Refreshed (Automatically or Manually) for rac
WARNING => ORACLE_HOME environment variable is set
FAIL => Opatch version is lower than recommended in RDBMS_HOME for /u01/app/oracle/product/11.2.0/db
FAIL => Opatch version is lower than recommended in GRID_HOME
INFO => Special Considerations for SCAN and HAIP of 11.2.0.2 and above Grid Infrastructure
INFO => Minimizing Planned Downtime for Upgrades and Patching
INFO => Upgrade Related References
INFO => Lifetime Support Policy and Product Certification INFO
INFO => Capture performance baseline, backup important configuration files and batch, cron, DBMS_JOBS and DBMS_SCHEDULER jobs
INFO => Known Issues Integrating pre-11gR2 Databases with Grid Infrastructure
INFO => Be Aware of New Instant Client for Simplified Deployment
INFO => Oracle E-Business Suite interoperability and migration resources
INFO => Oracle Software Download Sites
WARNING => One or More Object Names in ALL_OBJECTS table are Reserved Words for rac
WARNING => One or More Column Names in ALL_TAB_COLUMNS table are Reserved Words for rac
WARNING => Some Users Needing Network ACLs for Oracle Utility Packages Found for rac
INFO => Steps to execute rootupgrade.sh
INFO => Save "Oracle Enterprise Manager Database Control" files and data with the emdwgrd Utility before upgrading database.
INFO => Information about ASM process parameter when its not set to default value
INFO => Information about Grid Infrastructure software installation directory
WARNING => OS parameter vm.swappiness is NOT set to the recommended value
Copying results from dev02 and generating report. This might take a while. Be patient.
=============================================================
Node name - dev02
=============================================================
Collecting - /proc/cmdline
Collecting - /proc/modules
Collecting - CPU Information
Collecting - DiskFree Information
Collecting - DiskMount Information
Collecting - Kernel parameters
Collecting - Maximum number of semaphore sets on system
Collecting - Maximum number of semaphores on system
Collecting - Maximum number of semaphores per semaphore set
Collecting - Memory Information
Collecting - NUMA Configuration
Collecting - Network Interface Configuration
Collecting - Network Performance
Collecting - Network Service Switch
Collecting - OS Packages
Collecting - OS version
Collecting - Patches for Grid Infrastructure
Collecting - Patches for RDBMS Home
Collecting - number of semaphore operations per semop system call
Data collections completed. Checking best practices on dev02.
--------------------------------------------------------------------------------------
WARNING => ORACLE_HOME environment variable is set
FAIL => Opatch version is lower than recommended in RDBMS_HOME for /u01/app/oracle/product/11.2.0/db
FAIL => Opatch version is lower than recommended in GRID_HOME
INFO => Information about ASM process parameter when its not set to default value
---------------------------------------------------------------------------------
CLUSTERWIDE CHECKS
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
Detailed report (html) - /oracle/software/orachk_dev01_rac_101014_175251/orachk_dev01_rac_101014_175251.html
UPLOAD(if required) - /oracle/software/orachk_dev01_rac_101014_175251.zip
$
ORAchk generated a detailed report in html which provides the fixes for the failure and warning.
The sample HTML report is as below for the opatch version fix
Oracle RAC Upgrade Readiness Report
CRS Opatch version
Recommendation
Most recent opatch version is 11.2.0.3.6 (or higher). Download latest opatch from following MOS note and install.
Note :- report data may be empty if its role separated environment where oracle does not have permission to call opatch in GRID_HOME. Please run $CRS_HOME/OPatch/opatch version manually and verify that version is equal or higher than 11.2.03.6
Links
Note: 1373255.1 - 11.2.0.1/11.2.0.2 to 11.2.0.3 Database Upgrade on Exadata Database Machine
Note: 274526.1 - How To Download And Install The Latest OPatch Version
Needs attention on dev03, dev04
Passed on -
Status on dev03:
FAIL => Opatch version is lower than recommended in GRID_HOME
DATA FROM dev03 - CRS OPATCH VERSION
OPatch Version: 11.2.0.3.4
OPatch succeeded.
Status on dev04:
FAIL => Opatch version is lower than recommended in GRID_HOME
DATA FROM dev04 - CRS OPATCH VERSION
OPatch Version: 11.2.0.3.4
OPatch succeeded.
Great ORAchk tool from Oracle.
Part 2 coming soon...
Oracle recommends out-of place upgrade from 11.2.0.3 to 11.2.0.4
At the planning stage of the database and grid Infrastructure upgrade, Download and run the ORAchk utility from Oracle to verify and fix any issues before upgrading the clusterware, ASM and the database.
ORAchk Health Checks For The Oracle Stack
ORAchk tool is the advanced version of RACcheck tool and Oracle recommends to download the ORAchk tool to verify All the Oracle stack.
To download and more details about the script is in Oracle support
$ ./orachk -u -o pre
Enter upgrade target version (valid versions are 11.2.0.3.0, 11.2.0.4.0, 12.1.0.1.0, 12.1.0.2.0):- 11.2.0.4.0
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/grid?[y/n][y]y
Checking ssh user equivalency settings on all nodes in cluster
Node dev02 is configured for ssh user equivalency for oracle user
Searching for running databases . . . . .
. .
List of running databases registered in OCR
1. rac
2. None of above
Select databases from list for checking best practices. For multiple databases, select 1 for All or comma separated number like 1,2 etc [1-2][1].1
. .
Checking Status of Oracle Software Stack - Clusterware, ASM, RDBMS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-------------------------------------------------------------------------------------------------------
Oracle Stack Status
-------------------------------------------------------------------------------------------------------
Host Name CRS Installed RDBMS Installed CRS UP ASM UP RDBMS UP DB Instance Name
-------------------------------------------------------------------------------------------------------
dev01 Yes Yes Yes Yes Yes rac01
dev02 Yes Yes Yes Yes Yes rac02
-------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
Installed components summary
---------------------------------------------------------------------------------------------------------------------------------
GI_HOME ORACLE_HOME Database Names
---------------------------------------------------------------------------------------------------------------------------------
/u01/app/grid - 11.2.0.3.0 /u01/app/oracle/product/11.2.0/db - 11.2.0.3.0 rac
---------------------------------------------------------------------------------------------------------------------------------
Copying plug-ins
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . .
Checking Grid Infrastructure and RDBMS upgrade readiness to version 112040
Collections and audit checks log file is
/oracle/software/11204_DB/orachk_dev01_rac_110514_175251/log/orachk.log
Checking for prompts in /oracle/.bash_profile on dev01 for oracle user...
Checking for prompts in /oracle/.bash_profile on dev02 for oracle user...
Starting to run orachk in background on dev02
=============================================================
Node name - dev01
=============================================================
Collecting - ASM Diskgroup Attributes
Collecting - ASM initialization parameters
Collecting - Database Parameters for rac database
Collecting - Database Undocumented Parameters for rac database
Collecting - Pre-upgrade File Locations for rac database
Collecting - /proc/cmdline
Collecting - /proc/modules
Collecting - CPU Information
Collecting - DiskFree Information
Collecting - DiskMount Information
Collecting - Kernel parameters
Collecting - Maximum number of semaphore sets on system
Collecting - Maximum number of semaphores on system
Collecting - Maximum number of semaphores per semaphore set
Collecting - Memory Information
Collecting - NUMA Configuration
Collecting - Network Interface Configuration
Collecting - Network Performance
Collecting - Network Service Switch
Collecting - OS Packages
Collecting - OS version
Collecting - Patches for Grid Infrastructure
Collecting - Patches for RDBMS Home
Collecting - number of semaphore operations per semop system call
Data collections completed. Checking best practices on dev01.
--------------------------------------------------------------------------------------
INFO => Real World Network Bandwidth Guidelines
INFO => Important Automatic Storage Management (ASM) Notes and Technical White Papers
INFO => Unattended Installation and Configuration Options
INFO => Be aware of provided optional integrity checks
INFO => Patching Notes by Release
INFO => Prior to Upgrade Verify NO Materialized Views Being Refreshed (Automatically or Manually) for rac
WARNING => ORACLE_HOME environment variable is set
FAIL => Opatch version is lower than recommended in RDBMS_HOME for /u01/app/oracle/product/11.2.0/db
FAIL => Opatch version is lower than recommended in GRID_HOME
INFO => Special Considerations for SCAN and HAIP of 11.2.0.2 and above Grid Infrastructure
INFO => Minimizing Planned Downtime for Upgrades and Patching
INFO => Upgrade Related References
INFO => Lifetime Support Policy and Product Certification INFO
INFO => Capture performance baseline, backup important configuration files and batch, cron, DBMS_JOBS and DBMS_SCHEDULER jobs
INFO => Known Issues Integrating pre-11gR2 Databases with Grid Infrastructure
INFO => Be Aware of New Instant Client for Simplified Deployment
INFO => Oracle E-Business Suite interoperability and migration resources
INFO => Oracle Software Download Sites
WARNING => One or More Object Names in ALL_OBJECTS table are Reserved Words for rac
WARNING => One or More Column Names in ALL_TAB_COLUMNS table are Reserved Words for rac
WARNING => Some Users Needing Network ACLs for Oracle Utility Packages Found for rac
INFO => Steps to execute rootupgrade.sh
INFO => Save "Oracle Enterprise Manager Database Control" files and data with the emdwgrd Utility before upgrading database.
INFO => Information about ASM process parameter when its not set to default value
INFO => Information about Grid Infrastructure software installation directory
WARNING => OS parameter vm.swappiness is NOT set to the recommended value
Copying results from dev02 and generating report. This might take a while. Be patient.
=============================================================
Node name - dev02
=============================================================
Collecting - /proc/cmdline
Collecting - /proc/modules
Collecting - CPU Information
Collecting - DiskFree Information
Collecting - DiskMount Information
Collecting - Kernel parameters
Collecting - Maximum number of semaphore sets on system
Collecting - Maximum number of semaphores on system
Collecting - Maximum number of semaphores per semaphore set
Collecting - Memory Information
Collecting - NUMA Configuration
Collecting - Network Interface Configuration
Collecting - Network Performance
Collecting - Network Service Switch
Collecting - OS Packages
Collecting - OS version
Collecting - Patches for Grid Infrastructure
Collecting - Patches for RDBMS Home
Collecting - number of semaphore operations per semop system call
Data collections completed. Checking best practices on dev02.
--------------------------------------------------------------------------------------
WARNING => ORACLE_HOME environment variable is set
FAIL => Opatch version is lower than recommended in RDBMS_HOME for /u01/app/oracle/product/11.2.0/db
FAIL => Opatch version is lower than recommended in GRID_HOME
INFO => Information about ASM process parameter when its not set to default value
---------------------------------------------------------------------------------
CLUSTERWIDE CHECKS
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
Detailed report (html) - /oracle/software/orachk_dev01_rac_101014_175251/orachk_dev01_rac_101014_175251.html
UPLOAD(if required) - /oracle/software/orachk_dev01_rac_101014_175251.zip
$
ORAchk generated a detailed report in html which provides the fixes for the failure and warning.
The sample HTML report is as below for the opatch version fix
Oracle RAC Upgrade Readiness Report
System Health Score is 92 out of 100 (detail)
CRS Opatch versionRecommendation
Most recent opatch version is 11.2.0.3.6 (or higher). Download latest opatch from following MOS note and install.
Note :- report data may be empty if its role separated environment where oracle does not have permission to call opatch in GRID_HOME. Please run $CRS_HOME/OPatch/opatch version manually and verify that version is equal or higher than 11.2.03.6
Links
Note: 1373255.1 - 11.2.0.1/11.2.0.2 to 11.2.0.3 Database Upgrade on Exadata Database Machine
Note: 274526.1 - How To Download And Install The Latest OPatch Version
Needs attention on dev03, dev04
Passed on -
Status on dev03:
FAIL => Opatch version is lower than recommended in GRID_HOME
DATA FROM dev03 - CRS OPATCH VERSION
OPatch Version: 11.2.0.3.4
OPatch succeeded.
Status on dev04:
FAIL => Opatch version is lower than recommended in GRID_HOME
DATA FROM dev04 - CRS OPATCH VERSION
OPatch Version: 11.2.0.3.4
OPatch succeeded.
Great ORAchk tool from Oracle.
Part 2 coming soon...
Friday, 24 October 2014
ORA_01017: Invalid username/password error while creating a standby database
Issue: ORA_01017: Invalid username/password error while creating a standby database
$ rman TARGET sys/change_on_install@TEST
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Oct 24 15:24:44 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01017: invalid username/password; logon denied
Though I changed the passwords and recreated the password file in primary and copied back to standby server, still i received the invalid username and password on the standy
Solution:
SQL> show parameter REMOTE_LOGIN_PASSWORD
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string NONE
SQL> show parameter REMOTE_OS_AUTHENT
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_os_authent boolean FALSE
SQL>
The parameter remote_login_password file should be set to exclusive. Changed the value to EXCLUSIVE in primary and restarted the database
SQL> alter system set remote_login_passwordfile='EXCLUSIVE' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2405122048 bytes
Fixed Size 2255592 bytes
Variable Size 503317784 bytes
Database Buffers 1895825408 bytes
Redo Buffers 3723264 bytes
Database mounted.
Database opened.
SQL>
Now the rman command duplicate target database for standby works fine.
$ rman TARGET sys/change_on_install@TEST
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Oct 24 15:24:44 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01017: invalid username/password; logon denied
Though I changed the passwords and recreated the password file in primary and copied back to standby server, still i received the invalid username and password on the standy
Solution:
SQL> show parameter REMOTE_LOGIN_PASSWORD
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string NONE
SQL> show parameter REMOTE_OS_AUTHENT
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_os_authent boolean FALSE
SQL>
The parameter remote_login_password file should be set to exclusive. Changed the value to EXCLUSIVE in primary and restarted the database
SQL> alter system set remote_login_passwordfile='EXCLUSIVE' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2405122048 bytes
Fixed Size 2255592 bytes
Variable Size 503317784 bytes
Database Buffers 1895825408 bytes
Redo Buffers 3723264 bytes
Database mounted.
Database opened.
SQL>
Now the rman command duplicate target database for standby works fine.
Tuesday, 21 October 2014
Errors: ORA-00301, ORA-17502, ORA-15005 name is already used by an existing alias
Errors: ORA-00301, ORA-17502, ORA-15005
SQL> ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 5 ('+TEST_REDO/TEST_redo_t2g1m1',
2 3 '+TEST_REDO/TEST_redo_t2g1m2') size 20M,
4 GROUP 6 ('+TEST_REDO/TEST_redo_t2g2m1',
5 '+TEST_REDO/TEST_redo_t2g2m2') size 20M,
6 GROUP 7 ('+TEST_REDO/TEST_redo_t2g3m1',
7 '+TEST_REDO/TEST_redo_t2g3m2') size 20M,
8 GROUP 8 ('+TEST_REDO/TEST_redo_t2g4m1',
9 '+TEST_REDO/TEST_redo_t2g4m2') size 20M;
ALTER DATABASE ADD LOGFILE THREAD 2
*
ERROR at line 1:
ORA-00301: error in adding log file '+TEST_REDO/TEST_redo_t2g1m1' - file cannot be created
ORA-17502: ksfdcre:4 Failed to create file +TEST_REDO/TEST_redo_t2g1m1
ORA-15005: name "TEST_redo_t2g1m1" is already used by an existing alias
The problem is because the logfile exists in the ASM disks as below
servTEST501:grid $ asmcmd
ASMCMD> cd TEST_REDO
ls
ASMCMD> TEST/
TEST_def_temp_01
TEST_redo_t1g1m1
TEST_redo_t1g1m2
TEST_redo_t1g2m1
TEST_redo_t1g2m2
TEST_redo_t1g3m1
TEST_redo_t1g3m2
TEST_redo_t1g3m3
TEST_redo_t1g3m4
TEST_redo_t1g4m1
TEST_redo_t1g4m2
TEST_redo_t2g1m1
TEST_redo_t2g1m2
TEST_redo_t2g2m1
TEST_redo_t2g2m2
TEST_redo_t2g3m1
TEST_redo_t2g3m2
TEST_redo_t2g4m1
TEST_redo_t2g4m2
TEST_temp_01
ASMCMD> rm TEST_redo_t2g1m1
ASMCMD> rm TEST_redo_t2g1m2
;
:
ASMCMD>rm TEST_redo_t2g4m2
remove the logfiles created for thread 2 in the asm and recreate the logfiles
SQL> ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 5 ('+TEST_REDO/TEST_redo_t2g1m1',
'+TEST_REDO/TEST_redo_t2g1m2') size 20M,
2 3 4 GROUP 6 ('+TEST_REDO/TEST_redo_t2g2m1',
5 '+TEST_REDO/TEST_redo_t2g2m2') size 20M,
6 GROUP 7 ('+TEST_REDO/TEST_redo_t2g3m1',
7 '+TEST_REDO/TEST_redo_t2g3m2') size 20M,
8 GROUP 8 ('+TEST_REDO/TEST_redo_t2g4m1',
9 '+TEST_REDO/TEST_redo_t2g4m2') size 20M;
Database altered.
Explanation: Though we drop the logs using the sql command it is registered as dropped in the controlfile but the physical file exists which has to be removed manually.
SQL> ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 5 ('+TEST_REDO/TEST_redo_t2g1m1',
2 3 '+TEST_REDO/TEST_redo_t2g1m2') size 20M,
4 GROUP 6 ('+TEST_REDO/TEST_redo_t2g2m1',
5 '+TEST_REDO/TEST_redo_t2g2m2') size 20M,
6 GROUP 7 ('+TEST_REDO/TEST_redo_t2g3m1',
7 '+TEST_REDO/TEST_redo_t2g3m2') size 20M,
8 GROUP 8 ('+TEST_REDO/TEST_redo_t2g4m1',
9 '+TEST_REDO/TEST_redo_t2g4m2') size 20M;
ALTER DATABASE ADD LOGFILE THREAD 2
*
ERROR at line 1:
ORA-00301: error in adding log file '+TEST_REDO/TEST_redo_t2g1m1' - file cannot be created
ORA-17502: ksfdcre:4 Failed to create file +TEST_REDO/TEST_redo_t2g1m1
ORA-15005: name "TEST_redo_t2g1m1" is already used by an existing alias
The problem is because the logfile exists in the ASM disks as below
servTEST501:grid $ asmcmd
ASMCMD> cd TEST_REDO
ls
ASMCMD> TEST/
TEST_def_temp_01
TEST_redo_t1g1m1
TEST_redo_t1g1m2
TEST_redo_t1g2m1
TEST_redo_t1g2m2
TEST_redo_t1g3m1
TEST_redo_t1g3m2
TEST_redo_t1g3m3
TEST_redo_t1g3m4
TEST_redo_t1g4m1
TEST_redo_t1g4m2
TEST_redo_t2g1m1
TEST_redo_t2g1m2
TEST_redo_t2g2m1
TEST_redo_t2g2m2
TEST_redo_t2g3m1
TEST_redo_t2g3m2
TEST_redo_t2g4m1
TEST_redo_t2g4m2
TEST_temp_01
ASMCMD> rm TEST_redo_t2g1m1
ASMCMD> rm TEST_redo_t2g1m2
;
:
ASMCMD>rm TEST_redo_t2g4m2
remove the logfiles created for thread 2 in the asm and recreate the logfiles
SQL> ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 5 ('+TEST_REDO/TEST_redo_t2g1m1',
'+TEST_REDO/TEST_redo_t2g1m2') size 20M,
2 3 4 GROUP 6 ('+TEST_REDO/TEST_redo_t2g2m1',
5 '+TEST_REDO/TEST_redo_t2g2m2') size 20M,
6 GROUP 7 ('+TEST_REDO/TEST_redo_t2g3m1',
7 '+TEST_REDO/TEST_redo_t2g3m2') size 20M,
8 GROUP 8 ('+TEST_REDO/TEST_redo_t2g4m1',
9 '+TEST_REDO/TEST_redo_t2g4m2') size 20M;
Database altered.
Explanation: Though we drop the logs using the sql command it is registered as dropped in the controlfile but the physical file exists which has to be removed manually.
Tuesday, 8 July 2014
How to change the hostname on Oracle Enterprise Linux 6
How to change the hostname on Oracle Enterprise Linux 6?
If you want to change the hostname of the server, then edit the below two files
/etc/sysconfig/network
/etc/hosts
Lets take the example that we want to change the hostname "myserver001" to "hostserver001"
#vi /etc/sysconfig/network
HOSTNAME=myserver001
NETWORKING=yes
GATEWAY=172.21.110.54
NETWORKING_IPV6=no
IPV6INIT=no
NOZEROCONF=yes
If you want to change the hostname of the server, then edit the below two files
/etc/sysconfig/network
/etc/hosts
Lets take the example that we want to change the hostname "myserver001" to "hostserver001"
#vi /etc/sysconfig/network
HOSTNAME=myserver001
NETWORKING=yes
GATEWAY=172.21.110.54
NETWORKING_IPV6=no
IPV6INIT=no
NOZEROCONF=yes
After change
HOSTNAME=hostserver001
NETWORKING=yes
GATEWAY=172.21.110.54
NETWORKING_IPV6=no
IPV6INIT=no
NOZEROCONF=yes
Then update the /etc/hosts file
172.21.110.160 myserver001
After change
172.21.110.160 hostserver001
Now reboot the server..Your new name is assigned to the host.
NETWORKING=yes
GATEWAY=172.21.110.54
NETWORKING_IPV6=no
IPV6INIT=no
NOZEROCONF=yes
Then update the /etc/hosts file
172.21.110.160 myserver001
After change
172.21.110.160 hostserver001
Now reboot the server..Your new name is assigned to the host.
Friday, 27 June 2014
How to check the status of Oracle VM manager through perl / shell script?
How to check the status of Oracle VM manager through perl / shell script?
Scripting helps to automate a task. If you are looking for a script to check the status of the OVM then the below perl script can be used to check the status of the Oracle VM manager.
Save the file as check_vm_status.pl
#!/usr/bin/perl -w
my $status = `service ovmm status`;
chomp($status);
my $statusok = "Oracle VM Manager is running...";
if ( $status ne $statusok ) {
print "oracle vm is not running";
}
else
{
print "$status";
}
Scripting helps to automate a task. If you are looking for a script to check the status of the OVM then the below perl script can be used to check the status of the Oracle VM manager.
Save the file as check_vm_status.pl
#!/usr/bin/perl -w
my $status = `service ovmm status`;
chomp($status);
my $statusok = "Oracle VM Manager is running...";
if ( $status ne $statusok ) {
print "oracle vm is not running";
}
else
{
print "$status";
}
To run the script,
$ perl check_vm_status.pl
$ perl check_vm_status.pl
The output of the above script is as below, If the OVM is running then,
Oracle VM Manager is running...
If the OVM is not running then
oracle vm is not running
The same code can be used as Korn shell script as below
Save the file as check_vm_status.ksh
#!/usr/bin/ksh -w
$status = `service ovmm status`;
$statusok = "Oracle VM Manager is running...";
if ( $status ne $statusok ) {
print "oracle vm is not running";
}
else
{
print "oracle vm is running";
}
Hope this helps!
Save the file as check_vm_status.ksh
#!/usr/bin/ksh -w
$status = `service ovmm status`;
$statusok = "Oracle VM Manager is running...";
if ( $status ne $statusok ) {
print "oracle vm is not running";
}
else
{
print "oracle vm is running";
}
To run the script,
$ perl check_vm_status.ksh
$ perl check_vm_status.ksh
Hope this helps!
Tuesday, 15 April 2014
Using dd to copy multiple files or disks to a remote system
Using dd to copy multiple files / raw disks to a remote system
Let us say we have raw disks at server A and we want to copy the disks to server B
here are the steps
login to the server A and go to the directory
serverA001 # cd /dev/disks/
serverA001 # ls | while read i
> do
> dd if=$i ibs=4096 conv=notrunc,noerror | (ssh 172.02.129.198 dd of=/dev/disks/$i obs=4096)
> echo $i
> done
You need to enter the user password of the remote host to copy the files.
Let us say we have raw disks at server A and we want to copy the disks to server B
here are the steps
login to the server A and go to the directory
serverA001 # cd /dev/disks/
serverA001 # ls | while read i
> do
> dd if=$i ibs=4096 conv=notrunc,noerror | (ssh 172.02.129.198 dd of=/dev/disks/$i obs=4096)
> echo $i
> done
You need to enter the user password of the remote host to copy the files.
Thursday, 3 May 2012
Oracle Application Server Status
How to check Oracle Application Server Status?
On Windows services, check the status of OracleASControl and OracleProcessManager.
And for Oracle Process Monitor(OPMN) on command prompt execute opmnctl status command as shown below
ORACLE_HOME\opmn\bin>opmnctl status
Processes in Instance: OAS.XYZ.com
-------------------+--------------------+---------+---------
ias-component | process-type | pid | status
-------------------+--------------------+---------+---------
LogLoader | logloaderd | N/A | Down
dcm-daemon | dcm-daemon | 7688 | Alive
HTTP_Server | HTTP_Server | 22196 | Alive
WebCache | WebCache | 2332 | Alive
WebCache | WebCacheAdmin | 2340 | Alive
OC4J | home | 2372 | Alive
OC4J | OC4J_BI_Forms | 2364 | Alive
OC4J | OC4J_BI_Forms | 2380 | Alive
OC4J | OC4J_BI_Forms | 2396 | Alive
OC4J | OC4J_BI_Forms | 2388 | Alive
DSA | DSA | N/A | Down
The dcm, HTTP Server, WebCache, OC4J status should be alive.
On Windows services, check the status of OracleASControl and OracleProcessManager.
And for Oracle Process Monitor(OPMN) on command prompt execute opmnctl status command as shown below
ORACLE_HOME\opmn\bin>opmnctl status
Processes in Instance: OAS.XYZ.com
-------------------+--------------------+---------+---------
ias-component | process-type | pid | status
-------------------+--------------------+---------+---------
LogLoader | logloaderd | N/A | Down
dcm-daemon | dcm-daemon | 7688 | Alive
HTTP_Server | HTTP_Server | 22196 | Alive
WebCache | WebCache | 2332 | Alive
WebCache | WebCacheAdmin | 2340 | Alive
OC4J | home | 2372 | Alive
OC4J | OC4J_BI_Forms | 2364 | Alive
OC4J | OC4J_BI_Forms | 2380 | Alive
OC4J | OC4J_BI_Forms | 2396 | Alive
OC4J | OC4J_BI_Forms | 2388 | Alive
DSA | DSA | N/A | Down
The dcm, HTTP Server, WebCache, OC4J status should be alive.
11g DIAGNOSTIC_DEST Initialization parameter
Checking the background_dump_dest for alert log files and user_dump_dest for trace files and errors are going to be a past.
I was excited to know about the new oracle11g initialization parameter DIAGNOSTIC_DEST which replaced BACKGROUND_DUMP_DEST, USER_DUMP_DEST and CORE_DUMP_DEST parameters.
All the trace informations are stored in a single location specified using DIAGNOSTIC_DEST. This helps the Oracle 11g database advisors to have a single point of contact for all the information required to auto tune the SQL or database.
If we do not specify a location for this initialization parameter then it will default to the $ORACLE_BASE/diag
I was excited to know about the new oracle11g initialization parameter DIAGNOSTIC_DEST which replaced BACKGROUND_DUMP_DEST, USER_DUMP_DEST and CORE_DUMP_DEST parameters.
All the trace informations are stored in a single location specified using DIAGNOSTIC_DEST. This helps the Oracle 11g database advisors to have a single point of contact for all the information required to auto tune the SQL or database.
If we do not specify a location for this initialization parameter then it will default to the $ORACLE_BASE/diag
Error 45 initializing SQL*PLUS Internal Error
During pre-11g check the sql script execution fails with the "Error 45 Initializing SQL*PLUS" on the sqlplus as below
SQL> spool utlu1112i.log
SQL> @utlu112i.sql
Error 45 initializing SQL*Plus
Internal error
The reason is the path where the 11g script utlu112i.sql script copied to on the 10g database server.
Solution:
Copy the utlu112i.sql script to the $ORACLE_HOME/rdbms/admin directory and execute the script.
SQL> spool utlu1112i.log
SQL> @utlu112i.sql
Wednesday, 2 May 2012
Enterprise Manager 11g fails database instance unavailable
In Oracle 11g RAC the enterprise manager dbconsole doesn't start and gives an OC4J not available error.
If we try to deconfig using emca as below we receive an error database instance unavailable. If you face the same issue then here is one of the possible solution
export ORACLE_SID to the instance id not db id for example if your 2 node rac db is orcl then instance will be orcl1 & orcl2.
Set the ORACLE_SID to orcl2 and export the oracle sid
Go to oracle_home/bin directory and check the emca and emctl files and update if required for the ORACLE_HOME & ORACLE_SID.
And then execute the below command to remove the EM repository
[oracle@home bin]$ emca -deconfig dbcontrol db -repos drop
STARTED EMCA at May 2, 2012 11:17:49 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl1
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: Y
May 2, 2012 11:18:03 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/oracle/cfgtoollogs/emca/racdb/emca_2012_05_02_11_17_49.log.
May 2, 2012 11:18:03 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed.
May 2, 2012 11:18:06 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
If we try to deconfig using emca as below we receive an error database instance unavailable. If you face the same issue then here is one of the possible solution
export ORACLE_SID to the instance id not db id for example if your 2 node rac db is orcl then instance will be orcl1 & orcl2.
Set the ORACLE_SID to orcl2 and export the oracle sid
Go to oracle_home/bin directory and check the emca and emctl files and update if required for the ORACLE_HOME & ORACLE_SID.
And then execute the below command to remove the EM repository
[oracle@home bin]$ emca -deconfig dbcontrol db -repos drop
STARTED EMCA at May 2, 2012 11:17:49 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl1
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: Y
May 2, 2012 11:18:03 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/oracle/cfgtoollogs/emca/racdb/emca_2012_05_02_11_17_49.log.
May 2, 2012 11:18:03 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed.
May 2, 2012 11:18:06 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
And after dropping recreate the repository.
Tuesday, 3 April 2012
How to write a blob pdf data from the Oracle database to a pdf file
How to write a blob pdf data from the Oracle database to a pdf file
create directory orcl_dir as '/mnt/oracle/orcl_dir'
--In my example I am passing two variables
CREATE OR REPLACE PROCEDURE BLOBToFILESample (typeidin in number,varnamein IN VARCHAR2) IS
type_id number(11);
var_name varchar2(40);
v_blob BLOB;
blob_length INTEGER;
out_file UTL_FILE.FILE_TYPE;
v_buffer RAW(32767);
chunk_size BINARY_INTEGER := 32767;
blob_position INTEGER := 1;
BEGIN
-- Retrieve the BLOB for reading
SELECT myblobcolumn INTO v_blob FROM mytablename WHERE mycol1=typeidin and mycol2 = varnamein;
-- Retrieve the SIZE of the BLOB
blob_length:=DBMS_LOB.GETLENGTH(v_blob);
--ORCL_DIR is the directory which i have created on my database.
out_file := UTL_FILE.FOPEN ('ORCL_DIR', varnamein, 'wb', chunk_size);
-- Write the BLOB to file in chunks
WHILE blob_position <= blob_length LOOP
IF blob_position + chunk_size - 1 > blob_length THEN
chunk_size := blob_length - blob_position + 1;
END IF;
DBMS_LOB.READ(v_blob, chunk_size, blob_position, v_buffer);
UTL_FILE.PUT_RAW(out_file, v_buffer, TRUE);
blob_position := blob_position + chunk_size;
END LOOP;
-- Close the file handle
UTL_FILE.FCLOSE (out_file);
END;
/
The above code will save the file in the directory orcl_dir.
Some of the error I have encountered is when passing the parameters to the procedure do not give the same name as the column name. If you specify then you may encounter ora-01422 as below
ORA-01422: exact fetch returns more than requested number of rows
Tuesday, 27 March 2012
Voting Disk and OCR backups in Oracle 11g R2
In Oracle 11g R2, the OCR and voting disks are backed up automatically into a single file. To check the backup of the OCR and voting disks
# $GRID_HOME/bin/ocrconfig -showbackup
Where GRID_HOME is your Grid installation home directory. In my example is
# /u01/app/11.2.0/grid/bin/ocrconfig -showbackup
# $GRID_HOME/bin/ocrconfig -showbackup
Where GRID_HOME is your Grid installation home directory. In my example is
# /u01/app/11.2.0/grid/bin/ocrconfig -showbackup
Wednesday, 11 January 2012
How to move ocr and voting disks to a new directory in OCFS
How to move ocr and voting disks to a new directory in OCFS?
Moving OCR (Oracle Cluster Registry)
1. Login
as root user and check for a recent backup of the ocr file.
#ocrconfig –showbackup
2. If
the backup does not exists then take a backup
#ocrconfig –export –s online
3. Check
whether the crs and its processes are running
#crsctl check crs
4. Check
the location of the crs files
#ocrcheck
5. To
move the ocr file to a new location - /u01/oradata/racdb
#ocrconfig –replace ocr /u01/oradata/racdb/OCRFile
6. Check
whether the crs is pointed to new location
#ocrcheck
#cat /etc/oracle/ocr.loc
#Device/file /u02/oradata/racdb/OCRFile getting replaced
by device /u01/oradata/racdb
ocrconfig_loc=/u01/oradata/racdb/OCRFile
ocrmirrorconfig_loc=/u02/oradata/racdb/OCRFile_mirror
7. Check
the privilege and permissions of OCR file. It should be owned by root and group
dba/oinstall. If not change as below
#chown root:oinstall /u01/oradata/racdb/OCRFile
Moving voting disks to a new location
1. Login
as root
2. Stop
the clusterware
#crsctl stop crs
3. Check
the voting disks
#crsctl query crs votedisk
4. Take
a backup of the voting disk
#dd if=voting_disk_name
of=backup_file_name
5. Add
the voting disk to a new location
#crsctl add css votedisk
/u01/oradata/racdb/CSSFile –force
6. Delete
the old voting disk
#crsctl delete css votedisk
/u02/oradata/racdb/CSSFile –force
7. Check
the voting disk file permission
The css file should be owned
by oracle with oinstall / dba group depends on your primary group
8. Start
the cluster
#crsctl start crs
9. Check
the voting disk new location
#crsctl query crs votedisk
Tuesday, 10 January 2012
How to Stop a cluster in Oracle RAC
How to Stop a cluster in Oracle RAC
To stop a cluster in Oracle RAC, As a root user, execute
the command
# /bin/crsctl stop crs
If your crs home is /opt/oracle/crs then
#/opt/oracle/crs/bin/crsctl stop crs
Thursday, 29 December 2011
How to find the large log files older than one year to delete on unix
How to find the large log files older than one year to delete on unix?
To find the one year old large log files, execute the below command
find . -name '*.log' -size +200k -mtime +360 -print
where find is the command
. is for the current directory ( if you want to check on /var/log then specify the directory here)
'*.log' is to check for the log files
-size is to check for the size of the log files. I gave 200k
-mtime is to check for the time +360 for one year old files
-print is to show the files on the screen.
To find the one year old large log files, execute the below command
find . -name '*.log' -size +200k -mtime +360 -print
where find is the command
. is for the current directory ( if you want to check on /var/log then specify the directory here)
'*.log' is to check for the log files
-size is to check for the size of the log files. I gave 200k
-mtime is to check for the time +360 for one year old files
-print is to show the files on the screen.
Tuesday, 11 October 2011
Flashback Recovery Area Full - Unable to connect RMAN
Yesterday, There was an issue with the Flashback Recovery Area. The FRA disk is full and when we try to connect as "sys as sysdba" or "rman target", the database hangs.
If you are looking for a solution to similar scenario then read on...
Check the disk space for total, available and used space using df command in linux.
move to the archivelog folder in the flash recovery area for the database and check for the old logs.
If you have set the retention window to 7 days for example or have a backup taken 2-3 days before then you can remove the old logs to reclaim the disk space.
Now try to connect using the RMAN
rman target nocatalog
execute the crosscheck command to verify the backups and delete expired backups and logs.
Note, By removing the logs at OS level will not update the data dictionary hence the crosscheck command needs to be executed to cross verify the logs and files.
If you are looking for a solution to similar scenario then read on...
Check the disk space for total, available and used space using df command in linux.
move to the archivelog folder in the flash recovery area for the database and check for the old logs.
If you have set the retention window to 7 days for example or have a backup taken 2-3 days before then you can remove the old logs to reclaim the disk space.
Now try to connect using the RMAN
rman target nocatalog
execute the crosscheck command to verify the backups and delete expired backups and logs.
Note, By removing the logs at OS level will not update the data dictionary hence the crosscheck command needs to be executed to cross verify the logs and files.
Tuesday, 4 October 2011
How to create flashback restore point on database
How to create flashback restore point on database?
If the database is up, shutdown the database and restart the database in mount mode.
Check whether the flashback is on, If the flashback is not on then enable the flashback. Note: If you are using RAC then before enabling flashback make sure all other instances are shutdown
If you executed the flashback on command without shutting down the other instances, you will receive the below error
ERROR at line 1:
ORA-38777: database must not be started in any other instance.
Solution is to make sure all other instances are down.
After enabling the flashback, check the status to make sure the flashback is enabled on the database.
And check the DB_FLASHBACK_RETENTION_TARGET. By default it is 1440 which is one day. If you want for “n” no of days then the formula is 1440*n=value. For example if you want to retain for 3 days then 1440*3=4320
Alter the database to set the retention to 3 days.
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=4320;
And then create the restore point as below
CREATE RESTORE POINT before_my_change;
Wednesday, 28 September 2011
PXE-E32: TFTP Open Timeout - VMWARE - REDHAT LINUX Installtion
PXE-E32: TFTP Open Timeout
When Installing Redhat Linux on the newly created vmware vm machine, I received the error TFTP open timeout error.
Casuse: TFTP open request was not acknowledged.
Solution:
Verify that the TFTP service is running. If you are not using the TFTP then simply wait for few minutes, the boot prompt will come back automatically after sometime with operating system not found message. Now select the operating system iso image.
When Installing Redhat Linux on the newly created vmware vm machine, I received the error TFTP open timeout error.
Casuse: TFTP open request was not acknowledged.
Solution:
Verify that the TFTP service is running. If you are not using the TFTP then simply wait for few minutes, the boot prompt will come back automatically after sometime with operating system not found message. Now select the operating system iso image.
Subscribe to:
Posts (Atom)