My confrontations with oracle

November 4, 2008

Index

Filed under: oracle — John Jacob @ 11:43 pm

Make “n” number of connections to your DB using script in windows/unix

Restore the RMAN backup of a RAC to a Single Instance

Get Metadata of an Object in Oracle

Recovery of UNDO tablespace in a Non Archive Log mode Database

No quota on USERS tablespace? Then no EXPDP

Setting up Oracle VM using iSCSI storage

How to identify the type(32 or 64bit) of software installed ?

Recover from loss of Active redo log file

Recovery from the loss of Inactive redo log file

Recovery of non system datafile [ without backup ]

Recovery of Non System datafile [ while the database is closed ]

Recovery of Non System datafile [ while the database is open ]

Recovery of system01.dbf datafile

Tailor your Oracle account

DBA Handbook ?

OPatch failed with error code 73 ??

ORA-12541: TNS:no listener ??

Hardening Oracle Security ??

Who is referencing my table ??

Table Compression in Oracle

Oracle Recovery Scenarios

Securing oracle agents

Oracle RAC installation on Solaris SPARC 64 bit

Setting up APEX on a Standby Database Server

ORA-12560: TNS:protocol adapter error and oradim

Install Oracle in english on a machine with non english OS

Removing the semaphores of a ‘KILL’ed oracle instance

Relink -ing binaries of Oracle RDBMS and Oracle Agent

Process Monitor in Windows

Installing BUG fix 5749953-ONS SIGBUS ERROR AFTER INSTALL PATCHSET 10.2.0.3 FOR CRS

Installing patchset 10.2.0.3 on RAC RDBMS

Update RAC nodelist using runInstaller -updateNodeList

Revoke exp/imp from non privileged oracle users

Empty/Remove Oracle Listener.log files







November 6, 2009

CRS-0223: Resource has placement error while using SRVCTL

Few days back in the early wee hours, one of my RAC node db instance crashed.
Env: 10.2.0.4 RAC on Solaris 5.10 SPARC
alert.log said:

:
Errors in file /u01/app/oracle/admin/SHCL1/bdump/shcl1n02_j004_27414.trc:
ORA-07445: exception encountered: core dump [kglobcl()+412] [SIGSEGV] [Address not mapped to object] [0x49415C002] [] []
Tue Nov  3 00:00:27 2009
Trace dumping is performing id=[cdmp_20091103000027]
Tue Nov  3 00:00:37 2009
Errors in file /u01/app/oracle/admin/SHCL1/bdump/shcl1n02_pmon_3278.trc:
ORA-07445: [kglobcl()+412] [SIGSEGV] [Address not mapped to object] [0x49415C002] [] []
Tue Nov  3 00:00:51 2009
:
:
Tue Nov  3 00:00:54 2009
MMAN: terminating instance due to error 472
Instance terminated by MMAN, pid = 3368
Wed Nov  4 10:44:47 2009
:

I checked

$ crsctl check crs
OK (running successfully)
$ srvctl status nodeapps -n myjpsuolicdbd02
OK (all resources running successfully)
$ srvctl status database -d SHCL1_PRMY
Instance SHCL1N01 is running on node myjpsuolicdbd01
PRKO-2015 : Error in checking condition of instance on node: myjpsuolicdbd02

$

Since only instance 2 was down, i tried to start it and i got the below error.

$ srvctl start instance -d SHCL1_PRMY -i SHCL1N02
PRKP-1001 : Error starting instance SHCL1N02 on node myjpsuolicdbd02
CRS-1028: Dependency analysis failed because of:
CRS-0223: Resource ‘ora.SHCL1_prmy.SHCL1N02.inst’ has placement error.

$

The crsd.log file too didn’t have much(to the point) information.

2009-11-04 10:18:30.627: [  CRSRES][2970821] CRS-1028: Dependency analysis failed because of:'Resource in UNKNOWN state: ora.SHCL1_prmy.SHCL1N02.inst'

2009-11-04 10:21:23.269: [  CRSRES][2970843] StopResource: setting CLI values
2009-11-04 10:21:23.340: [  CRSRES][2970843] Attempting to stop `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02`
2009-11-04 10:21:30.478: [  CRSAPP][2970843] StopResource error for ora.SHCL1_prmy.SHCL1N02.inst error code = 1
2009-11-04 10:21:30.502: [  CRSRES][2970843] Stop of `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02` succeeded.
2009-11-04 10:21:49.867: [  CRSRES][2970861] startRunnable: setting CLI values
2009-11-04 10:21:49.895: [  CRSRES][2970861] Attempting to start `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02`
2009-11-04 10:21:55.019: [  CRSAPP][2970861] StartResource error for ora.SHCL1_prmy.SHCL1N02.inst error code = 1
2009-11-04 10:22:00.583: [  CRSAPP][2970861] StopResource error for ora.SHCL1_prmy.SHCL1N02.inst error code = 1
2009-11-04 10:22:00.592: [  CRSRES][2970861] X_OP_StopResourceFailed : Stop Resource failed
(File: rti.cpp, line: 1803

2009-11-04 10:22:00.593: [  CRSRES][2970861][ALERT] `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02` has experienced an unrecoverable failure.
2009-11-04 10:22:00.593: [  CRSRES][2970861] Human intervention required to resume its availability.

Clusterware and nodeapps were up and running but db instance on node 2.

I could startup the instance from sqlplus, but this would not start the db services etc ora.SHCL1_prmy.SHCL1N02.inst was not ONLINE and would be of no use in a RAC.
Didn’t have any clue, until I came across the logs under /u01/app/oracle/product/10.2.0/db_1/log/<hostname>/racg/imonSHCL1_prmy.log and imon_SHCL1_prmy.log.

The files imonSHCL1_prmy.log and imon_SHCL1_prmy.log contains details of the starting up of the DB using SRVCTL command.

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Nov 4 18:59:48 2009
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Enter user-name: ERROR:
ORA-01031: insufficient privileges

Enter user-name: SP2-0306: Invalid option.

2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon>  ::= <username>[/<password>][@<connect_identifier>] | /
Enter user-name: Enter password:
ERROR:
ORA-01005: null password given; logon denied

2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: clsrcexecut: env _USR_ORA_PFILE=
2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: clsrcexecut: cmd = /u01/app/oracle/product/10.2.0/db_1/bin/racgeut -e _USR_ORA_DEBUG=0 -e ORACLE_SID=SHCL1N02 520 /u01/app/oracle/product/10.2.0/db_1/bin/racgmdb -d abort

Due to security concern, recently i added “ SQLNET.AUTHENTICATION_SERVICES=(NONE) ” to sqlnet.ora and this line would insist on providing the password explicitly. It doesn’t allow to login using “sqlplus / as sysdba”. Hence the SRVCTL failed.

So,

After removing this line from sqlnet.ora, i could start the instance.

1)Commented the entry in sqlnet.ora
2)crs_stop -f ora.SHCL1_prmy.SHCL1N02.inst
3)crs_stat -u => to confirm that the TARGET and STATE are OFFLINE for ora.SHCL1_prmy.SHCL1N02.inst
4)srvctl start instance -d SHCL1_PRMY -i SHCL1N02
Raised an SR for the ORA 7445 error and let me see what they have in stock for me.

October 6, 2009

Configure heterogeneous connection from Oracle DB to PostgreSQL DB

Filed under: oracle — John Jacob @ 7:51 pm
Tags: , , ,

An organisation have lot of choices to choose from the RDBMS world.Oracle Database, Microsoft SQL Server, IBM DB2,PostgreSQL, MySQL are few of them. Most of the organisations out there do have a mix of all these which are used to store their data and in course of time it is inevitable that they would want to transfer data from ‘this database’ to ‘that database’. Oracle, the uncrowned king of this RDBMS world call this “Heterogeneous Connectivity” and have incorporated this facility into their database and this is installed by default.

Oracle documentation says:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/tgvsgc.htm#sthref36

The Heterogeneous Services component in the Oracle database server talks to a Heterogeneous Services agent process which, in turn, talks to the non-Oracle system. We can conceptually divide the code into three parts:

1)The Heterogeneous Services component in the Oracle database server.
Most of the processing related to heterogeneous connectivity is done in this module.
2)Agent generic code.
This is code in the agent that is generic to all Heterogeneous Services products. This consists, for the most part, of code to communicate with the database and multithreading support.
3)The driver.
This is the module that communicates with the non-Oracle system. It is used to map calls from the Heterogeneous Services onto the native API of the non-Oracle system and it is non-Oracle system specific.

Connecting to PostgreSQL from Oracle using an ODBC data source

To connect to a PostgreSQL from Oracle, we will have to use the Oracle Generic Connectivity Agent(hsodbc).
A simple call would be like: Oracle DB -> Oracle Heterogeneous Service -> Oracle Generic Connectivity Agent -> ODBC Driver for PostgreSQL -> PostgreSQL DB
http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/gencon.htm#i1005976

Oracle does not provide the ODBC driver for PostgreSQL, it should be acquired from third party. I downloaded the psqlOBDC driver from http://www.postgresql.org/download/products/2 .

1.PostgreSQL Server [PostgreSQL 8.3.5 on Windows]
1.1)Create the DB and user, which would be used by oracle to make connection.

2.Oracle Server [Oracle 10.2.0.1 on Windows]
2.1)Install Oracle(standard edition also will do)
2.2)Create a database
2.3)Go to $ORACLE_HOME/hs/admin/ and confirm the files
2.4)Download and install the psqlOBDC driver from postgresql.org
2.5)Create the ODBC data source
2.6)Configure initHSODBC.ora ($ORACLE_HOME/hs/admin/) and listener.ora and tnsnames.ora ($ORACLE_HOME/network/admin/)
2.7)Create the database link

This post will cover only the details to be done at the Oracle side.

2.1 – 2.3:
I installed oracle 10.2.0.1 standard edition and created a generic database.
The $ORACLE_HOME/hs/admin/ would contain the files inithsodbc.ora,inithsoledb.ora,listener.ora.sample and tnsnames.ora.sample.
The inithsodbc.ora is the one of our interest. We will configure it later.

2.4:
I downloaded the “psqlodbc_08_04_0100.zip”(the latest when i installed) from http://www.postgresql.org/ftp/odbc/versions/msi/ .
(I could not access this site using IE and hence used Firefox.)
The installation is nothing big the typical “click next button”

Click Next -> Accept the terms -> Next -> Install -> Finish

2.5:
Go to Control Panel -> Administrative Tools -> Data Sources -> System DSN -> Add

Select the “PostgreSQL ANSI” driver -> Finish.

Enter the ODBC Datasource name ( i gave PG), Server Name (put the IP address of PostgreSQL DB server), Database Name (PostgreSQL DB name) and User Name (PostgreSQL userid) and password.
Click “Test” to test the connection to PostgreSQL DB and it would show “Connection Succesful” and Save. Now we have an ODBC Data Source called “PG”.

2.6:
Now we have the datasource PG which would use the ODBC driver psqlODBC.
We need to configure 3 files to complete the connectivity
a)initHSODBC.ora
b)listener.ora
c)tnsnames.ora

a.1)
Go to $ORACLE_HOME/hs/admin/ and make a copy of the initHSODBC.ora and name it init<SID>.ora, where sid is the system identifier you want to use for the instance of the non-Oracle system to which the agent connects and i renamed the file to “initPG.ora“. Edit the file and provide the ODBC Data Source Name which we created in step 2.5.

# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
#
# HS init parameters
#
HS_FDS_CONNECT_INFO = PG                        <<- ODBC Data Source Name
HS_FDS_TRACE_LEVEL = ON
#
# Environment variables required for the non-Oracle system
#
#set <envvar>=<value>

b.1)

Listener.ora ($ORACLE_HOME/network/admin/)

 SID_LIST_LISTENER =
 (SID_LIST =
 (SID_DESC =
 (SID_NAME = PG)          <<- Should be same as the SID in $ORACLE_HOME/hs/admin/initSID.ora 
 (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
 (PROGRAM = hsodbc)       <<- Set the program as "hsodbc"
 )
 (SID_DESC =
 (SID_NAME = PLSExtProc)
 (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
 (PROGRAM = extproc)
 )
 )

LISTENER =
 (DESCRIPTION_LIST =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))        <<- Set key as PNPKEY
 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.20)(PORT = 1521))
 )
)

Restart the listener.

The sid that you add to the listener.ora file must match the sid in an initsid.ora file, because the agent spawned by the listener searches for a matching initsid.ora file. When you copy and rename the initsid.ora file, ensure that it remains in the $ORACLE_HOME/hs/admin directory

c.1)

Add an entry for the PostgreSQL DB into the tnsnames.ora for the DB link to work.

 PG =
 (DESCRIPTION=
 (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.20.20)(PORT=1521))
 (CONNECT_DATA=(SID=PG))
 (HS=OK)
 )

Confirm the “tnsping PG” works.

2.7:
Create the database link in oracle

 create public database link topg connect to "postgreuser" identified by "password" using 'PG';

Confirm the DBlink to PostgreSQL using this query.

 select * from all_tables@topg

Unlike Oracle, PostgreSQL is case sensitive. So for user tables(other than all_tables) use the double quotes like

 select * from "tbl_user_data"@topg;
 

References:

http://www.databasejournal.com/features/oracle/article.php/10893_3442661_2/Making-a-Connection-from-Oracle-to-SQL-Server.htm

http://birijan.com.np/?q=Oracle+Heterogeneous+Services+(Accessing+ODBC+datasource)

August 20, 2009

Make “n” number of connections to your DB using script in windows/unix

Recently i had to set up a db for an App and wanted to test the how better the server scaled when there are “n” number of connections at a time. I did it on a Windows 2003 server. Below is the script which i wrote for this.

On Windows

make_conn.bat
——————

FOR %%A in (1 2 3) DO start sqlplus userid/passwd@tns_entry @conn.sql

conn.sql
———–

select sysdate from dual;
exec dbms_lock.sleep(10);
exit;

Save both the files in the same folder with respective names.
Now double click the make_conn.bat and this would create 3 connections to the db and will exceute the conn.sql in each. The contents of the conn.sql are self explanatory. To make more connections all you need to do is to add more numerics to the FOR statement. Changing the make_conn.bat to (1 2 3 1 2 3 1 2 3 4 5 6) would create 12 connections and the more numbers you add, more threads(connections) are created.

If you want to trigger the connections from cmd.exe then you will need to modify the FOR statement like :

FOR %A in (1 2 3) DO start sqlplus userid/passwd@burp @conn.sql

Note that there is only one % symbol.

On Unix/Linux

make_conn.sh
—————–

#!/bin/ksh
#
#Make n number of connections to db
#
#
echo "Enter the number of connections to make :\c"
read NOF;
i=0
while [[ $i -lt $NOF ]];
do
 sqlplus -s userid/passwd @conn.sql >/dev/null &
 i=$i+1
done
exit;

conn.sql
——–

select sysdate from dual;
exec dbms_lock.sleep(10);
exit;

$chmod 755 make_conn.sh
$make_conn.sh

The “&” in the while loop will run the process in background and will direct the o/p to /dev/null, so you will not see any message in your terminal unless there is an error.

In both cases, you can test your number of connections by

select count(8) from v$session where username=’USERID’;

July 28, 2009

Restore the RMAN backup of a RAC to a Single Instance

The source database is a 2 Node RAC Database(10.2.0.4)
Source :
Unique Name    : SHCL1DR
Db_Name           : SHCL1
SID                        : SHCL1DR2

The destination will be a single instnace.
Destination :
Unique Name    : SHCL1REC
Db_Name           : SHCL1
SID                        : SHCL1REC

1] Prepare SHCL1DR for taking RMAN backup

  • 1.a] Create directories to store the RMAN backup
 mkdir /u04/RMAN_BACKUPS
  • 1.b] Configure the RMAN persistant parameters to point to the backup directory and enable controlfile autobackup.
export ORACLE_SID=SHCL1DR2
 rman target /
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
 CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 5 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 6 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';

The backupsets will be created under /u04/RMAN_BACKUPS/ and the controlfile would be backed up at the default location.

 RMAN> show all;
 using target database control file instead of recovery catalog
 RMAN configuration parameters are:
 CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 90 DAYS;
 CONFIGURE BACKUP OPTIMIZATION ON;
 CONFIGURE DEFAULT DEVICE TYPE TO DISK;
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
 CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
 CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 6;
 CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
 CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
 CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 5 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 6 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE MAXSETSIZE TO UNLIMITED;
 CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
 CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
 CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
 CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_SHCL1DR2.f'; # default
RMAN>
  • 1.c] Take the backup from on of the node
rman target /
 crosscheck archivelog all;
 backup database plus archivelog;

I used the below script to run RMAN in background mode.

 T02[SHCL1DR2]$ cat /export/home/oraprd/bkp.sh
 #!/bin/sh
 rman target / <<EOF
 backup database plus archivelog;
 exit;
 EOF
 exit
 T02[SHCL1DR2]$
 T02[SHCL1DR2]$ nohup /export/home/orapd/bkp.sh > /export/home/orapd/bkp. 2>&1 &    

2] Prepare environmet for SHCL1REC

  • 2.a] Create the directories to hold the controlfile,redo logs,datafiles and archivelogs

(I used the same machine, hence restored to a different location)
mkdir /u02/oracle/shcl1rec/

This directory would hold all files pertaining to this new instance.
(If you are going to use this restored instance for Prod or Dev activities, use separate directories.
All i wanted was to test the backups, hence restoring them to same dir for simplicity)

 mkdir /u01/app/oracle/admin/SHCL1REC/adump        
 mkdir /u01/app/oracle/admin/SHCL1REC/bdump
 mkdir /u01/app/oracle/admin/SHCL1REC/cdump
 mkdir /u01/app/oracle/admin/SHCL1REC/udump
 mkdir /u02/oracle/shcl1rec/archivelogs

  • 2.b] Restore the spfile from the controlfile backup
 export ORACLE_SID=SHCL1REC
 rman target /
 startup nomount
 restore spfile from '/u02/oracle/shcl1/flashbacklog/SHCL1DR/autobackup/2009_07_23/o1_mf_s_692991347_56j874gd_.bkp';

[Make sure that you have enough memory for the SGA as that of the Source DB, else you cannot mount using this
spfile as its a clone of the source spfile. If not enough memory, then copy the initSHCL1DR2.ora to initSHCL1REC.ora]

  • 2.c] Modify the initSHCL1REC.ora file

Change the path for controlfiles,*dumps,archive_logs.
Comment the cluster parameters
Change the db_unique_name,service_names and domain
Change the SGA and PGA
Comment/change those parameters that refer the RAC instances.

  • 2.d] Using this new init.ora file, start the instance in nomount mode.
  • 2.e] Restore the controlfile from the backup

export ORACLE_SID=SHCL1REC
 rman target /    
 restore controlfile from '/u02/oracle/shcl1/flashbacklog/SHCL1DR/autobackup/2009_07_23/o1_mf_s_692991347_56j874gd_.bkp';
 alter database mount;
RMAN> restore controlfile from '/u02/oracle/shcl1/flashbacklog/SHCL1DR/autobackup/2009_07_22/o1_mf_s_692897986_56ff1mk7_.bkp';
Starting restore at 22-JUL-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=647 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/u02/oracle/shcl1rec/control1
output filename=/u02/oracle/shcl1rec/control2
output filename=/u02/oracle/shcl1rec/control3
Finished restore at 22-JUL-09
RMAN>
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN>
 

Confirm that the control files are created under /u02/oracle/shcl1rec/.

  • 2.f] Create the password file for the new instance.

RMAN need to connect to the new instance as sysdba, so create the password file.
For simplicity copy the password file of the source.

 cp $ORACLE_HOME/dbs/orapwSHCL1DR2 $ORACLE_HOME/dbs/orapwSHCL1REC
  • 2.g] Create the tns entry

RMAN would need dedicated connection, so if dispatchers are configured, then make sure you have SERVER=DEDICATED
embedded in the tnsenrty.

SHCL1REC =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST=10.28.19.6)(PORT= 1521))
 (CONNECT_DATA = (SERVICE_NAME = SHCLREC.s.com) (SERVER = DEDICATED))
)   
  • 2.h] Configure the persistant parameters for the new instance

Configure the rman persistant parameter (to change the connection string)

 CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 5 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 6 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';    
  • 2.i] Prepare the RMAN restore script and restore it.

Since we are using a different path for datafiles, we need to specify it using the ‘SET NEWNAME’ and rename the
redo log files.

 select 'set newname for datafile '|| file# ||' to '''||name||'''' from v$datafile;
 select member from v$logfile;

Below is the script that i used

T02[SHCL1DR2]$ cat /export/home/oraprd/restore.sh        
#!/bin/ksh
rman target / <<EOF    
set newname for datafile 1 to '/u02/oracle/shcl1rec/system01.dbf';
set newname for datafile 2 to '/u02/oracle/shcl1rec/undo01.dbf';
set newname for datafile 3 to '/u02/oracle/shcl1rec/sysaux01.dbf';
set newname for datafile 4 to '/u02/oracle/shcl1rec/undo02.dbf';
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo1_1.log'' to ''/u02/oracle/shcl1rec/redo1_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo1_2.log'' to ''/u02/oracle/shcl1rec/redo1_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo2_1.log'' to ''/u02/oracle/shcl1rec/redo2_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo2_2.log'' to ''/u02/oracle/shcl1rec/redo2_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo3_1.log'' to ''/u02/oracle/shcl1rec/redo3_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo3_2.log'' to ''/u02/oracle/shcl1rec/redo3_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo4_1.log'' to ''/u02/oracle/shcl1rec/redo4_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo4_2.log'' to ''/u02/oracle/shcl1rec/redo4_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo5_1.log'' to ''/u02/oracle/shcl1rec/redo5_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo5_2.log'' to ''/u02/oracle/shcl1rec/redo5_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo6_1.log'' to ''/u02/oracle/shcl1rec/redo6_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo6_2.log'' to ''/u02/oracle/shcl1rec/redo6_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo7_1.log'' to ''/u02/oracle/shcl1rec/redo7_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo7_2.log'' to ''/u02/oracle/shcl1rec/redo7_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo8_1.log'' to ''/u02/oracle/shcl1rec/redo8_1.log'' ";
sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo8_2.log'' to ''/u02/oracle/shcl1rec/redo8_2.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo01.log'' to ''/u02/oracle/shcl1rec/standby_redo01.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo02.log'' to ''/u02/oracle/shcl1rec/standby_redo02.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo03.log'' to ''/u02/oracle/shcl1rec/standby_redo03.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo04.log'' to ''/u02/oracle/shcl1rec/standby_redo04.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo05.log'' to ''/u02/oracle/shcl1rec/standby_redo05.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo06.log'' to ''/u02/oracle/shcl1rec/standby_redo06.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo07.log'' to ''/u02/oracle/shcl1rec/standby_redo07.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo08.log'' to ''/u02/oracle/shcl1rec/standby_redo08.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo09.log'' to ''/u02/oracle/shcl1rec/standby_redo09.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo10.log'' to ''/u02/oracle/shcl1rec/standby_redo10.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl0.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl0.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl1.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl1.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl2.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl2.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl3.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl3.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl4.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl4.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_1srl0.f'' to ''/u02/oracle/shcl1rec/SHCL1_1srl0.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_1srl1.f'' to ''/u02/oracle/shcl1rec/SHCL1_1srl1.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_1srl2.f'' to ''/u02/oracle/shcl1rec/SHCL1_1srl2.f'' ";
restore database;switch datafile all;
recover database;
exit;
EOF
exit    
T02[SHCL1DR2]$                
T02[SHCL1DR2]$ nohup /export/home/oraprd/restore.sh > /export/home/oraprd/restore.log 2>&1 &

  • 2.j] Open the database using RESETLOGS
 rman target /
 alter database open resetlogs;
 Opening the database would create the redologs, but not the standby logs.

  • 2.k] Remove the standby redologs

Since the source db contained standby redo logs, either we should create it or should drop them, else we would
get ORA-00313 errors as the files are not created along with the redologs.

 Errors in file /u01/app/oracle/admin/SHCL1REC/bdump/shcl1rec_arc2_12529.trc:
 ORA-00313:

 *** SERVICE NAME:(SYS$BACKGROUND) 2009-07-24 17:59:53.687
 *** SESSION ID:(631.5) 2009-07-24 17:59:53.687
 *** 2009-07-24 17:59:53.687 2561 kcrf.c
 tkcrf_clear_srl: Started clearing Standby Redo Logs   
 ORA-00312: /u02/oracle/shcl1rec/standby_redo01.log'
 SVR4 Error: 2: No such file or directory
 Additional information: 3                              
 ORA-00312: /u02/oracle/shcl1rec/standby_redo02.log'
 SVR4 Error: 2: No such file or directory
 SQL> select group#,status,type from v$logfile;

 GROUP# STATUS                TYPE
---------- --------------------- ---------------------
 1                       ONLINE
 1                       ONLINE
 2                       ONLINE
 2                       ONLINE
 3                       ONLINE
 3                       ONLINE
 4                       ONLINE
 4                       ONLINE
 5                       ONLINE
 5                       ONLINE
 6                       ONLINE
 6                       ONLINE
 7                       ONLINE
 7                       ONLINE
 8                       ONLINE
 8                       ONLINE
 9                       STANDBY
 10                       STANDBY
 11                       STANDBY
 12                       STANDBY
 13                       STANDBY
 14                       STANDBY
 15                       STANDBY
 16                       STANDBY
 17                       STANDBY
 18                       STANDBY
 19                       STANDBY
 20                       STANDBY
 21                       STANDBY
 22                       STANDBY
 23                       STANDBY
 24                       STANDBY
 25                       STANDBY
 26                       STANDBY

34 rows selected.

 alter database drop standby logfile group 9
 alter database drop standby logfile group 10
 alter database drop standby logfile group 11
 alter database drop standby logfile group 12
 alter database drop standby logfile group 13
 alter database drop standby logfile group 14;
 alter database drop standby logfile group 15;
 alter database drop standby logfile group 16;
 alter database drop standby logfile group 17;
 alter database drop standby logfile group 18;
 alter database drop standby logfile group 19;
 alter database drop standby logfile group 20;
 alter database drop standby logfile group 21;
 alter database drop standby logfile group 22;
 alter database drop standby logfile group 23;
 alter database drop standby logfile group 24;
 alter database drop standby logfile group 25;
 alter database drop standby logfile group 26;

  • 2.l] Disable the redo thread(unused)

Typically, an oracle instance would have only 1 redo thread. An n node RAC would have n redo threads.
Since we restored the backup of a 2 node RAC database to a single instance, whilst startup of the single instnace
Oracle would consider one of the thread as Private to the instance and the other as Public.
A peep into the alert.log says, this instance has mounted redo thread 1.

 :
 Mon Jul 27 13:45:56 2009
 Successful mount of redo thread 1, with mount id 1863696975
 Mon Jul 27 13:45:56 2009
 Database mounted in Exclusive Mode
 Completed: ALTER DATABASE   MOUNT
 :

 SQL> select group#,thread#,sequence#,status from v$log;

 GROUP#    THREAD#  SEQUENCE# STATUS
 ---------- ---------- ---------- ------------------------------------------------
 1          1          5 INACTIVE
 2          1          6 ACTIVE
 3          1          7 CURRENT
 4          1          4 INACTIVE
 5          2          1 INACTIVE
 6          2          2 INACTIVE
 7          2          3 INACTIVE
 8          2          4 CURRENT

 8 rows selected.

Groups 1-4 belong to the Thread 1, which is private to this instance and 5-8 belong to Thread 2, which is public.
Means, this instance would write the commit/rollback changes only to thread 1, but in case of recovery it would use
thread 2 also.

A look into the archivelog destination says,

 -rw-r-----   1 oraprd   oinstall    1024 Jul 27 14:03 SHCL1REC_2_2_693078959.arch
 -rw-r-----   1 oraprd   oinstall 4768768 Jul 27 14:03 SHCL1REC_1_5_693078959.arch
 -rw-r-----   1 oraprd   oinstall    1024 Jul 27  2009 SHCL1REC_2_3_693078959.arch
 -rw-r-----   1 oraprd   oinstall 1798144 Jul 27  2009 SHCL1REC_1_6_693078959.arch

The size of the archive logs created by Thread 2 are much small when compared to those created by Thread 1.
I used the logminer utility to confirm that the Thread 2 does not contain any Undo/Rollback data.

–Mining archvielog from Thread 1

 EXECUTE DBMS_LOGMNR.ADD_LOGFILE( LOGFILENAME => '/u02/oracle/shcl1rec/archivelogs/SHCL1REC_1_6_693078959.arch', OPTIONS => DBMS_LOGMNR.NEW);
 EXECUTE DBMS_LOGMNR.START_LOGMNR( OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
 SQL> select count(8) from V$LOGMNR_CONTENTS;
 COUNT(8)
 ----------
 5449
 EXECUTE DBMS_LOGMNR.END_LOGMNR();

–Mining archvielog from Thread 2

 EXECUTE DBMS_LOGMNR.ADD_LOGFILE( LOGFILENAME => '/u02/oracle/shcl1rec/archivelogs/SHCL1REC_2_3_693078959.arch', OPTIONS => DBMS_LOGMNR.NEW);
 EXECUTE DBMS_LOGMNR.START_LOGMNR( OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
 SQL>  select count(8) from V$LOGMNR_CONTENTS;
 COUNT(8)
 ----------
 0
 EXECUTE DBMS_LOGMNR.END_LOGMNR();

No data is being written to the thread 2 ( log groups# 5,6,7 and 8 ), so we can disable it using:

 ALTER DATABASE DISABLE THREAD 2;

 SQL>  select group#,thread#,sequence#,status from v$log;

 GROUP#    THREAD#  SEQUENCE# STATUS
 ---------- ---------- ---------- ------------------------------------------------
 1          1          5 INACTIVE
 2          1          6 INACTIVE
 3          1          7 CURRENT
 4          1          4 INACTIVE
 5          2          1 INACTIVE
 6          2          2 INACTIVE
 7          2          3 INACTIVE
 8          2          4 INACTIVE

 8 rows selected.

Since Group# 8 was the CURRENT(of Thread 2) before disabling, archive it.

 SQL> alter system archive log group 8;
 System altered.

Now we can drop the groups that belonged to Thread 2.

 ALTER DATABASE DROP LOGFILE GROUP 5;
 ALTER DATABASE DROP LOGFILE GROUP 6;
 ALTER DATABASE DROP LOGFILE GROUP 7;
 ALTER DATABASE DROP LOGFILE GROUP 8;
SQL>  select group#,thread#,sequence#,status from v$log;
 
 GROUP#    THREAD#  SEQUENCE# STATUS
 ---------- ---------- ---------- ------------------------------------------------
 1          1          5 INACTIVE
 2          1          6 INACTIVE
 3          1          7 CURRENT
 4          1          4 INACTIVE

June 29, 2009

April 6, 2009

Recovery of UNDO tablespace in a Non Archive Log mode Database

Every transaction stores the post modification data in the undo tablespace for a rollback or read consistency or flash back query or for recovery in case of abort. All system transactions will use the rollback segments created in the system tablespace. It cannot be used by other schema operations, they should use the undo tablespace. So an Undo tablespace is a must for any transaction to occur. If the database is in Archivelog mode, the recovery of an Undo tablespace is same as that of any Non-System tablespace,but how to recover if the database is in Non Archivelog Mode ?

While shutdown
++++++++++++++
This will work only if the database is shutdown properly(shutdown immediate).
If the database was aborted, oracle would do the ‘instance recovery’ whilst next startup and would terminate if the undo tablespace isn’t present.

SQL> startup;
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              67111156 bytes
Database Buffers           96468992 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '/u01/oradata/burp/undotbs01.dbf'

Since the database in Non Archive Log mode, we cannot open the database by taking the datafile offline using ‘alter database datafile 2 offline’,but we need to use ‘…OFFLINE FOR DROP‘. This will mark the datafile for subsequent dropping.A datafile once marked ‘OFFLINE FOR DROP’ can never be brought online.

SQL>alter database datafile 2 offline for drop;
SQL>alter database open;

Now we need to create another undo tablespace for the transactions to use. Once the new undo tablespace is created,shutdown the database and edit the init.ora file and change the parameter undo_tablepace=<new_undo_tablespace>

SQL>create undo tablespace UNDOTBS2 datafile '/path/undotbs02.dbf' size 20M;
SQL>shutdown immediate;

edit the init.ora file and set paramter undo_tablespace=UNDOTBS2

SQL>startup;

Now we will drop UNDOTBS1 as it is nolonger used.

SQL>drop tablespace UNDOTBS1 including contents and datafiles;

While database is OPEN
+++++++++++++++++++

SQL>create undo tablespace UNDOTBS2 datafile '/path/undotbs02.dbf' size 20M;
SQL>shutdown immediate;

edit the init.ora file and set paramter undo_tablespace=UNDOTBS2

SQL>startup;

Now we will drop UNDOTBS1 as it is nolonger used.

SQL>drop tablespace UNDOTBS1 including contents and datafiles;

January 28, 2009

No quota on USERS tablespace? Then no EXPDP.

Filed under: oracle, troubleshooting — John Jacob @ 3:23 pm

When i tried to export objects from a schema using EXPDP using the userid and passwd as that of the schema name, it failed.

my [DR1]$ expdp SCHEMAS=dprd PARFILE=exp_include.par
Export: Release 10.2.0.3.0 - 64bit Production on Wednesday, 28 January, 2009 14:47:15
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Username: DPRD
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
ORA-31626: job does not exist
ORA-31633: unable to create master table "DPRD.SYS_EXPORT_SCHEMA_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 863
ORA-01950: no privileges on tablespace 'USERS'

Well, the error message clearly says “no privileges on tablespace ‘USERS’“.

Yes, oracle will create some temporary tables whilst the expdp.So, no quota on users? then no expdp. Then i granted some quota on tablespace USERS to user DPRD.

SQL>alter user DPRD quota 10M on USERS;

User altered.

While the expdp was in process, i found the below objects created on tablespace USERS

SQL>select segment_name,segment_type,bytes from dba_segments where owner='DBKPRD' and tablespace_name='USERS';
SEGMENT_NAME                   SEGMENT_TYPE                        BYTES
------------------------------ ------------------------------ ----------
SYS_LOB0000154588C00039$$      LOBSEGMENT                          65536
SYS_MTABLE_000025BDC_IND_1     INDEX                              131072
SYS_C00119124                  INDEX                               65536
SYS_IL0000154588C00039$$       LOBINDEX                            65536
SYS_EXPORT_SCHEMA_01           TABLE                              131072
SQL>

Do we have any control on the tablespace name ?
yet to find it out :(

December 25, 2008

Setting up Oracle VM using iSCSI storage

Virtualization Technology isn’t new to the technical magazines, but the frevour at which companies bring out their virtualization products shows how HOT it has become at the data centers at this point when the companies vie each other to go GREEN.

Oracle has brought out the Oracle Virtualization Product using the Xen hypervisor,  an Open Source s/w and widely used in all Linux Distributions for virtualization. This product of Oracle comes with an Oracle VM Server and an Oracle VM Manager, a Java based interface to manage the Virtualization.

I have created my TEST environment using 4 desktops and below is how i went about.

ora_vm_arch

As shown in the above picture i used 4 machines.
Machine Details
————————
Manager
——-
CPU        -Intel P4 3Ghz [1 core]
RAM      -500 MB
HDD       -40 GB [SCSI]
OS           -Oracle Enterprise Linux 5.2

Storage
——-
CPU        -Intel P4 3Ghz [1 core]
RAM      -1 GB
HDD       -80 GB [SCSI]
OS           -Openfiler 2.1

VMS1
——-
CPU        -Intel P4 3Ghz [2 core]
RAM      -2 GB
HDD       -80 GB [SCSI]
OS[Dom]-Oracle VM Server 2.1.2

VMS2
——-
CPU        -Intel P4 3Ghz [1 core]
RAM        -2 GB
HDD        -80 GB [SCSI]
OS[Dom0]-Oracle VM Server 2.1.2

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Files to download
——————
——–
Oracle Enterprise Linux 5.2(32bit)         – http://edelivery.oracle.com/linux
Oracle VM Server 2.1.2(32bit)                  – http://edelivery.oracle.com/linux
Oracle VM Manger 2.1.2(32bit)                – http://edelivery.oracle.com/linux
Oracle EL 5.2 Template(32bit)                  – http://edelivery.oracle.com/linux
Oracle RDBMS 10g(Linux 32bit)              – http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linuxsoft.html
VNC Viewer Plugin for VM Manager(32bit)    – http://oss.oracle.com/oraclevm/manager/RPMS/

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Setting up Manager
——————
———-
Install OEL 5.2

-Firewall    =No
-Selinux    =Disabled
-IP Address    =192.168.20.99/255.255.255.0
-Hostname    =Manger
-Root Pswd    =redhat

Install Oracle VM Manager 2.1.2
http://download.oracle.com/docs/cd/E11081_01/doc/doc.21/e10902/ovmig.htm#BHCDACIH

Install the downloaded VNC viewer plugin. This plugin is required if we want to get the console of guests’ from VM Manager.
[Manager:root]$rpm -ivh ovm-console-1.0.0-2.i386.rpm

Stop the iptables and ip6tables services

[Manager:root]$service iptables stop
[Manager:root]$service ip6tables stop

Make sure that it doesn’t start in the next reboot

[Manager:root]$chkconfig –levels 345 iptables off
[Manager:root]$chkconfig –levels 345 ip6tables off

Add the below to the /etc/hosts
192.168.20.98    storage
192.168.20.99    manager
192.168.20.100    vms1
192.168.20.101  vms2
192.168.20.102  guest1

Setting up Storage
————————-

Install Openfiler 2.1

-Select manual partition
-Delete all existing partitions(if they do exist)
- /                =20 GB*
SWAP        =2 GB
Keep the rest as Free Space, this free space can be used as the shared iSCSI Storage.
-Firewall    =No
-Selinux     =No
-IP address    =192.68.20.98/255.255.255.0
-Hostname    =Storage

* Even 1 Gb would do for “/” [it used only 500 MB for my installation] and less for SWAP

Setting up VMS1
—————–
——
Install Oracle VM Server 2.1.2

[Follow the documentation http://download.oracle.com/docs/cd/E11081_01/doc/doc.21/e10899.pdf]
-Go for the default options
-IP Address        =192.168.20.100/255.255.255.0
-Hostname          =VMS1
-Agent Password    =vmagent
-Root Password      =redhat

Stop the iptables and ip6tables

[VMS1:root]$service iptables stop
[VMS1:root]$service ip6tables stop

Make sure that it doesn’t start in the next reboot

[VMS1:root]$chkconfig –levels 345 iptables off
[VMS1:root]$chkconfig –levels 345 ip6tables off

Setting up VMS2
—————–
——-
Install Oracle VM Server 2.1.2

[Follow the documentation http://download.oracle.com/docs/cd/E11081_01/doc/doc.21/e10899.pdf]
-Go for the default options
-IP Address        =192.168.20.101/255.255.255.0
-Hostname         =VMS2
-Agent Password    =vmagent
-Root Password      =redhat

Stop the iptables and ip6tables

[VMS2:root]$service iptables stop
[VMS2:root]$service ip6tables stop

Make sure that it doesn’t start in the next reboot

[VMS2:root]$chkconfig –levels 345 iptables off
[VMS2:root]$chkconfig –levels 345 ip6tables off

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Configure iSCSI Storage
———————–
———–
[Check Jeffery Hunter's RAC with iSCSI for more detailed explanation on setting up shared iSCSI storage and FAQ's and debugging]

From the browser in Manager:
https://192.168.20.98:446/
Userid          =openfiler
Password    =password

Go to SERVICES/ENABLE-DISABLE tab

op2

Click “Enable” for iSCSI target and the status would change from Disabled to Enabled.

On Storage
[STORAGE]$service iscsi-target status
=>it should be running

Go to GENERAL/LOCAL NETWORKS tab
op4

Add the network, whose machines would mount the storage
Name                  = Network 20
Network/Host= 192.168.20.0    => All our machines are in this network
Netmask            = 255.255.255.0
Type                    = Share
[UPDATE]

Go to VOLUMES/PHYSICAL STORAGE MGMT tab
op6

Here we can see the disk /dev/sda of 74.50 Gb with 2 partitions
[click VIEW]    /dev/sda1 for “/” and /dev/sda2 for “SWAP

Click /dev/sda under “Edit Disk” and Scroll Down to “Create a partition in /dev/sda” with the FREE SPACE in the disk
Cylinders 1 to 2107 of /dev/sda are used by / and SWAP of STORAGE

Mode                       =Primary
Partition Type     =Physical Volume
Startig Cylinder  =<let it be the default>
Ending Cylinder  =<let it be the default>

[CREATE]

op7

op8

:

Go to GENERAL tab

:

Go to VOLUMES/VOLUME GROUP MGMT tab
op9

Enter the Volume Group Name            =data
Select the physical volumes to add     =/dev/sda3

[ADD VOLUME GROUP]

:

Go to VOLUMES/CREATE NEW VOLUME
op10

Select the volume group    =data
Create Volume in data
Volume name        =data
Volume Desc         =data
Reqd Space            =<drag the slider to end>
Filesystem Type  =iSCSI

[CREATE]

Go to VOLUMES/LIST EXISTING VOLUMES

op11

Click “EDIT” for the volume “data” and
Scroll down to ‘iSCSI host access configuration for volume “data”
and select “Allow” for Access
[UPDATE]

op12

Make iSCSI clients available to clients
[STORAGE:root]$service iscsi-target restart

Make sure that the service ‘iscsi-target’ is started after restart
[STORAGE:root]$chkconfig –levels 345 iscsi-target on
[STORAGE:root]$chkconfig –list iscsi-target

Discovering Shared iSCSI on VMS1 and VMS2
——————————————–
——————–
[do it from both VMS1 and VMS2]
Discover the shared iSCSI using the ‘iscsiadm‘ utility that comes along with VM Server.
[http://download.oracle.com/docs/cd/E11081_01/doc/doc.21/e10898.pdf]

$iscsiadm -m discovery -t sendtargets -p <iscsi server>

[VMS1:root]$iscsiadm -m discovery -t sendtargets -p 192.168.20.98
192.168.20.98:3260,1 iqn.2006-01.com.openfiler:data.data

The discovered partitions will appear only after restarting the iscsi service
$cat /proc/partitions
$service iscsi restart
$cat /proc/partitions

[root@vms1 ~]# cat /proc/partitions
major minor  #blocks  name
8     0   78125000 sda
8     1     104391 sda1
8     2   23663745 sda2
8     3   50154930 sda3
8     4          1 sda4
8     5    3148708 sda5
8     6    1052226 sda6
[root@vms1 ~]# service iscsi restart
Stopping iSCSI daemon: /etc/init.d/iscsi: line 33:  3006 Killed         /etc/init.d/iscsid stop
iscsid dead but pid file exists                            [  OK  ]
Turning off network shutdown. Starting iSCSI daemon:       [  OK  ]
[  OK  ]
Setting up iSCSI targets: Login session [192.168.20.98:3260 iqn.2006-01.com.openfiler:data.data]
[  OK  ]
[root@vms1 ~]#
[root@vms1 ~]# cat /proc/partitions
major minor  #blocks  name
8     0   78125000 sda
8     1     104391 sda1
8     2   23663745 sda2
8     3   50154930 sda3
8     4          1 sda4
8     5    3148708 sda5
8     6    1052226 sda6
8    16   61177856 sdb               ===> the shared disk is discovered    
[root@vms1 ~]#

Create and Format the discoverd iSCSI device using OCFS2 file system
———————————————————————
——————————
[do it only from either VMS1 or VMS2]

Create partition on the shared iSCSI disk
[VMS1:root]$fdisk /dev/sdb
n -new partition
p -primary partition
w -write and quit

[root@vms1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.The number of cylinders for this disk is set to 59744.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdb: 62.6 GB, 62646124544 bytes
64 heads, 32 sectors/track, 59744 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-59744, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-59744, default 59744):
Using default value 59744

Command (m for help): p
Disk /dev/sdb: 62.6 GB, 62646124544 bytes
64 heads, 32 sectors/track, 59744 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       59744    61177840   83  Linux

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@vms1 ~]#
[root@vms1 ~]# fdisk -l
Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2            6781        9726    23663745   83  Linux
/dev/sda3              14        6257    50154930   83  Linux
/dev/sda4            6258        6780     4200997+   5  Extended
/dev/sda5            6258        6649     3148708+  83  Linux
/dev/sda6            6650        6780     1052226   82  Linux swap / Solaris
Partition table entries are not in disk order

Disk /dev/sdb: 62.6 GB, 62646124544 bytes
64 heads, 32 sectors/track, 59744 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       59744    61177840   83  Linux
[root@vms1 ~]#

Create the OCFS2 file system on the partition using mkfs utility
[VMS1:root]$mkfs.ocfs2 -b 4K -C 32K -N 4 -L data /dev/sdb1
[VMS1:root]$partprobe

[root@vms1 ocfs2]# mkfs.ocfs2 -b 4K -C 32K -N 4 -L data /dev/sdb1
mkfs.ocfs2 1.2.7
Overwriting existing ocfs2 partition.
Proceed (y/N): y
Filesystem label=data
Block size=4096 (bits=12)
Cluster size=32768 (bits=15)
Volume size=62646091776 (1911807 clusters) (15294456 blocks)
60 cluster groups (tail covers 8703 clusters, rest cover 32256 clusters)
Journal size=268435456
Initial number of node slots: 4
Creating bitmaps: done
Initializing superblock: done
Writing system files: done
Writing superblock: done
Writing backup superblock: 3 block(s)
Formatting Journals: done
Writing lost+found: done
mkfs.ocfs2 successful
[root@vms1 ~]#

Configure the shared partition on VMS1 and VMS2
————————————————————————-
[do it on VMS1 and copy the file to VMS2]

Create the cluster.conf file under /etc/ocfs2
This cluster.conf file will have the details of the nodes that will be participating in a Cluster.
So in our case, the cluster name will be OCFS2 and the number of nodes will be 2 (VMS1 and VMS2). Later, should a new VM Server be added to this cluster, the details of it should be added to this cluster.conf.
All the machines(nodes) participating in a cluster should have the same cluster.conf entries.

[VMS1:root]$mkdir /etc/ocfs2
[VMS1:root]$cd /etc/ocfs2
[VMS1:root]$touch cluster.conf
<I had the below in my cluster.conf>

[root@vms1 ocfs2]# cat cluster.conf
node:
     ip_port         =7777
     ip_address      =192.168.20.100
     number          =1
     name            =vms1
     cluster         =ocfs2
node:
     ip_port         =7777
     ip_address      =192.168.20.101
     number          =2
     name            =vms2
     cluster         =ocfs2
cluster:
     node_count      =2
     name            =ocfs2
[root@vms1 ocfs2]#

Create /etc/ocfs2 dir on VMS2 and copy the cluster.conf from VMS1 to VMS2 .

Mounting the shared disk
—————————-
———
[do below on both VMS1 and VMS2]

[VMS1:root]$service o2cb status
[VMS1:root]$service o2cb load
[VMS1:root]$service o2cb online
[VMS1:root]$service o2cb configure =>go for the defaults>
[VMS1:root]$service o2cb start

<if any typo err in the cluster.conf it will throw error, in that case correct the typo error and offline and unload o2cb >
[VMS1:root]$sevice o2cb offline
[VMS1:root]$sevice o2cb unload
:
:

Make sure the service O2CB is started after reboot
[VMS1:root]$chkconfig –levels 345 o2cb on
[VMS1:root]$chkconfig –list o2cb

Try to mount the shared iSCSI disk manually to check:
$mount /dev/sdb1 /OVS -t ocfs2
Unmount it
$umount /dev/sdb1

For the High Availability to work,
The shared disk must be mounted under /OVS and should be in /etc/ovs/repositories instead of mounting by adding details in fstab.
Make entries in the /etc/ovs/repositories using the /usr/lib/ovs-makerepo command
[http://download.oracle.com/docs/cd/E11081_01/doc/doc.21/e10898/ha.htm#CHDEFABI]

$/usr/lib/ovs/ovs-makerepo /dev/sdb1 C “cluster root”
$/usr/lib/ovs/ovs-cluster-check –alter-fstab

<this should be done on all the vm servers(vms1 and vms2)>

[root@vms1 OVS]# /usr/lib/ovs/ovs-makerepo /dev/sdb1 C "cluster root"
Initializing NEW repository /dev/sdb1
Updating local repository list.
ovs-makerepo complete
[root@vms1 OVS]#
[root@vms1 OVS]# cat /etc/ovs/repositories
# This configuration file was generated by ovs-makerepo
# DO NOT EDIT
@211419C38BD34CE4A0B9083A47F7AEBF /dev/sdb1
[root@vms1 OVS]#
[root@vms1 OVS]# /usr/lib/ovs/ovs-cluster-check
Need to remove /OVS mount from /etc/fstab, but --alter-fstab not specified.
[root@vms1 OVS]# /usr/lib/ovs/ovs-cluster-check --master --alter-fstab
Backing up original /etc/fstab to /tmp/fstab.BJZxu20292
Removing /OVS mounts in /etc/fstab
O2CB cluster ocfs2 already online
Cluster setup complete.
[root@vms1 OVS]#

REBOOT both vms1 and vms2 and confirm that the shared disk is mounted under /OVS on both using df -h command.

Now we have,
Storage ready with iSCSI
Manager with VM Manager
VMS1 with VM Server and shared iSCSI storage mounted under /OVS
VMS2 with VM Server and shared iSCSI storage mounted under /OVS

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Create/Add Server pool and Servers from Oracle VM Manager
———————————————————-—————————–
On MANAGER:

Server Pools -> Create Pool ->
Create the pool Pool1 with VMS1 as Server Master, Utility Server (provide root/<root_passwd>) and VM Server
Enable HA

Servers -> Add Server
Select pool ‘Pool1′ and add the server VMS2 as VM Server.

create_server_pool_2

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Creating the Guest OS
——————————–

Create VM Guest is divided into 4 sections:
1]Download and register the template
2]Create the VM guest OS
3]Access VM guest OS
4]Configure Hostname and IP address for Guest OS


1] Download and register the template

Download “Oracle Enterprise Linux 5 Update 2 template -PV Small x86(32 bit).zip” from http://edelivery.oracle.com/linux
Two templates are available for download.
Small – 4Gb
Large – 10gb
The default root password is ovsroot.

Oracle VM Manger can download/register the template from HTTP/FTP source or from a Machine in the Server Pool or Linux P2V Import.

We will download the file and copy it to either VMS1 or VMS2, which are members of the pool ‘Pool1‘.

Create the seed_pool directory to hold the templates so that the VM Manger can detect and register the template. The seed_pool directory should be directly under /OVS. Unzip and untar the file in seed_pool and then import and register the template from VM Manager.

[VMS1:root]mkdir /OVS/seed_pool
[VMS1:root]mv “Oracle Enterprise Linux 5 Update 2 template -PV Small x86(32 bit).zip” /OVS/seed_pool/
[VMS1:root]unzip “Oracle Enterprise Linux 5 Update 2 template -PV Small x86(32 bit).zip”
[VMS1:root]tar -xzvf OVM_EL5U2_X86_PVM_10GB.tgz
[VMS1:root]

Once the OVM_EL5U2_X86_PVM_4GB.tgz is untarred, the template will be available in OVM_EL5U2_X86_PVM_4GB directory. After extracting the tar file the size of the OVM_EL5U2_X86_PVM_4GB.tgz will be around 6.5GB, so make sure that you have enough space in seed_pool before extracting the tar file.

To Discover and Register the template:

VM Manager -> Resources -> Virtual Machine Templates -> Select from Server Pool -> [Next]

template_registration_1

[APPROVE]

2]Create the VM

VM Manger -> Virtual Machines -> [Create Virtual Machine]

create_vm_1_1

[NEXT]

The Preferred Server = Auto/Manual . I chose MANUAL and selected VMS1 as the preferred server

create_vm_2_2

[NEXT]

Select the OEL 5.2 template. Select the one we have registered now (4Gb).

create_vm_3_3

[NEXT]

Enter the Virtual Machine Name and the Console password and enable HA too. The console password is needed to access the guest OS through vncviewer or VM Manger Console option. This password will be in vm.cfg. (Console Password= oracle)

create_vm_4_4

[NEXT]

create_vm_5_5

[CONFIRM]

create_vm_6_6

[CREATE VIRTUAL MACHINE]

After the creation the GUEST2 will be in ‘Powered OFF’ state.
There will be a direcotry created under /OVS/running_pool/ for this Paravitualized Guest.
cd /OVS/running_pool/52_guest2/

Actually what happens is that the manager will make a copy of the template in the seed_pool to running_pool. So the drive should have a minimum of around 6.5 GB of space, since we use the ’small’ template. So you can monitor this activity from the ovs_operation.log of the utility server, in our case its VMS1.

[VMS1:root]$tail -f /var/log/ovs_agent/ovs_operation.log

Also to monitor the ‘cp’ status.
[VMS1:root]$ cd /OVS/running_pool
[VMS1:root]$du -sh */
and monitor the disk space used

create_vm_7_7

As mentioned after the creation the Virtual Machine will be in “Powered OFF” state.
The directory /OVS/running_pool/<vm name>/, will contain the system.img file and the vm.cfg for this Guest2. The vm.cfg should be modified for the guest2.

I modified my vm.cfg to

[VMS1:root]$cd /OVS/running_pool/52_guest2/
[VMS1:root]$cat vm.cfg
bootloader = '/usr/bin/pygrub'
disk = ['file:/OVS/running_pool/52_guest2/system.img,hda,w']
maxmem = 600
memory = 500
name = '52_guest2'
on_crash = 'restart'
on_reboot = 'restart'
uuid = 'cfd16fd1-1c7f-691a-51b9-2c5cbcc714a9'
vcpus = 1
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=oracle']
vif = ['bridge=xenbr0,mac=00:16:3E:5C:1C:F6,type=netfront']
vif_other_config = []

VM Manager-> Select Guest2 and “Power On”

create_vm_8_8

The status of the guest os ’start’ operation can be checked from the log file (check /var/log/ovs-agent/ovs_operation.log for success in starting or not ) on the VM server where the guest is started.

"2008-12-18 10:59:18" INFO=> xen_start_vm: success. vm('/OVS/running_pool/12_guest1')
"2008-12-18 10:59:18" INFO=> start_vm: vm('/OVS/running_pool/12_guest1') on srv('192.168.20.100') => success
"2008-12-18 10:59:18" INFO=> start_vm: success. vm('/OVS/running_pool/12_guest1') ip=''

3]Access VM Guest OS

Once the Guest2 is running, we can connect to it using the

(i)The ‘console’ option from VM Manager provided ovm-console-1.0.0-2.i386.rpm is installed on the Manager server.
Select the Guest2 -> Console -> ‘provide the vncpassword’
If you have forgot the vncpassword, its mentioned in /OVS/running_pool/<guest_name>/vm.cfg

(ii)vncviewer utility
[Manager:root]$vncviewer <vnc_server>:<port>

[Manager:root]$vncviewer 192.168.20.100:5900

The vncserver is the virtual server(VMS1 or VMS2) hosting the guestOS.
The first guest will use port 5900, the second will use 5901 and so on. Provide the VNC_Password when asked.

(iii)xm console <domain_name>
[VMS1:root]$xm console 52_guest2
Login: root
Passwd: ovsroot
=> the default root password for root in OEL Template is ovsroot

4] Configure Hostname and IP address for Guest OS

By deault the guestOS from template doesn’t have any IP address or hostname. We need to edit 3 files to set it.

(i)/etc/sysconfig/network
HOSTNAME=guest2
NETWORKING=yes
..

(ii)/etc/hosts
<add hostname and ip address>
192.168.20.101        guest2

(iii)/etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR should be the same as the MAC in vm.cfg of VMSERVER(in /OVS/running_pool/<vmserver_name>/vm.cfg)
IPADDR should be the same as in the /etc/hosts file

[GUEST2:root]$cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82540EM Gigabit Ethernet Controller
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.20.255
HWADDR=00:08:74:FC:6F:06
IPADDR=192.168.20.99
NETMASK=255.255.255.0
NETWORK=192.168.20.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

Finally restart the network service

$service network restart

Log files
————-
VM Agent
/opt/ovs-agent-2.2/logs/ovs_trace.log
service ovs-agent status/start/stop/restart
VM Server
/var/log/xen/
var/log/ovs-agent/ovs_operation.log (on utility server)

Troubleshooting
————————

(i) If for some reason the shared disk is not mounted:

1]check for o2cb status (unload,load and online)
2]cat /etc/partitions        => check whether the partition is discovered ?
3]service iscsi restart
4]cat /etc/partitions        => check whether the partition is discovered ?
5]/usr/lib/ovs-cluster-check => OK ?
6]/etc/init.d/ovsrepositories start

(ii) Installing Oracle

The most of the kernel values are already configured in the template. The template OS doesn’t have X server for the GUI installation of Oracle RDBMS.

To install oracle using GUI connect using ssh with X flag

[MANAGER:root]ssh -X oracle@guest1
./runInstaller.sh

(iii)Mounting CD ROM in Guest OS

Check this site http://www.option-c.com/xwiki/Xen_CDROM_Support

(iv)Uninstall VM Manager

/opt/ovs-manager-2.1/bin/runInstaller
<all files pertaining to ovm manager will be removed including the XE database>

(v)Registering existing VM guests in VM manager

Resources-> Virtual Machine Images-> Import -> Select from server pool(discover and register)
The system.img and vm.cfg file are supposed to be under /OVS/running_pool/<guest_name>/

References
http://download.oracle.com/docs/cd/E11081_01/welcome.html
http://forums.oracle.com
http://www.oracle.com/technology/pub/articles/hunter_rac10gr2_iscsi.html

December 4, 2008

How to identify the type(32 or 64bit) of software installed ?

Filed under: oracle — John Jacob @ 11:25 am
Tags: ,

One of the first thing that we should consider before any patching is to identify the type of software installed.Upgrading a 32bit intallation using a patch for 64bit would make your day hell.

Well, for Oracle RDBMS one could identify it from the messages while executing sqlplus uid/passwd from the oracle db home.

[]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Thu Dec 4 11:02:28 2008
Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL>

But how about Oracle Agent, Oracle HTTP Server, Oracle Cluster etc.
The software type is mentioned in every ORACLE_HOME/inventory/ContentsXML/oraclehomeproperties.xml. I believe this file is available in almost all oracle products(i have checked for rdbms,cluster,agent,client,http server,Grid Control(oms)).

For 64 bit software installations on Solaris SPARC 64bit OS it will be

 <ARU_PLATFORM_INFO>
      <ARU_ID>23</ARU_ID>
      <ARU_ID_DESCRIPTION>Solaris Operating System (SPARC 64-bit)
                </ARU_ID_DESCRIPTION>
   </ARU_PLATFORM_INFO>

For 32 bit software installations on Solaris SPARC 64bit OS it will be

   <ARU_PLATFORM_INFO>
                <ARU_ID>453</ARU_ID>
                <ARU_ID_DESCRIPTION>Solaris Operating System (SPARC 32-bit)
                </ARU_ID_DESCRIPTION>
    </ARU_PLATFORM_INFO>

For 32 bit installations on Win2k 32bit OS it will be

 <ARU_PLATFORM_INFO>
               <ARU_ID>912</ARU_ID>
               <ARU_ID_DESCRIPTION>Microsoft Windows (32-bit)
               </ARU_ID_DESCRIPTION>
  </ARU_PLATFORM_INFO>

For 32 bit installations on CentOS 32bit OS it will be

 <ARU_PLATFORM_INFO>
              <ARU_ID>46</ARU_ID>
              <ARU_ID_DESCRIPTION>Linux x86
              </ARU_ID_DESCRIPTION>
  </ARU_PLATFORM_INFO>

On Solaris SPARC environments ARU_ID =23 is for 64bit and 453 is for 32bit software installations.
I ‘am not sure of other environments, may be some one can update me :D .

Recover from loss of Active redo log file

Filed under: Oracle Backup and Recovery, oracle — John Jacob @ 11:15 am
Tags: , , ,

LGWR,logwriter writes the redo data from the log buffer cache to the redo log files when,
1] A transaction is commited
2] Every 3 Seconds
3] When redo log buffer is 1/3 full

The LGWR process writes to the redo log file in a circluar fashion. After log group 1 is written, the LGWR will move to log group 2 and meanwhile ARC(archiver) will archive log group 1. The LGWR will complain if one or all of the members of a log group are missing. The database will be  unable to serve any requests if all members of group are missing.

If all the members of a redo log group goes missing before the ARC process could archive it.
Oracle complains with error ORA-00313,ORA-00312,ORA-27037 once all members of the log file group goes missing.
The database halts unable to switch the log file.

1] Shutdown the database
2] Restore the datafiles and proceed for an incomplete recovery until the missing log sequence.
2] Mount the database
startup mount;
3] Check the status of the missing log file group from v$log view.
select group#,sequence#,bytes,first_change#,to_char(first_time,’DD-MM-YY hh24:mi:ss’) tim,status from v$log;
5] If STATUS = ACTIVE and ARCHIVED = NO
recover database until time ‘yyyy-mm-dd:hh24:mi:ss’;
* ’ss’ in the seconds should be 1 second less than the first_time of the missing redo log file.
6] Open the database with resetlogs option
7] Take a solid backup

===ARENA===

Mon Oct 27 15:04:18 2008
Errors in file /u01/app/oracle/admin/burp/bdump/burp_arc0_5826.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/burp/oradata/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

I did shutdown the DB and restored the *.dbf files.

cp -rp /u01/burp/backup u01/burp/oradata/

Startup mount;

SQL> select group#,sequence#,bytes,first_change#,to_char(first_time,'DD-MM-YY hh24:mi:ss') tim,status from v$log;
    GROUP#  SEQUENCE#      BYTES FIRST_CHANGE# TIM               STATUS
---------- ---------- ---------- ------------- ----------------- ----------------
         1        148    5242880        206241 27-10-08 15:02:14 INACTIVE
         3        147    5242880        206196 27-10-08 15:02:13 INACTIVE
         2        149    5242880        206336 27-10-08 15:04:18 CURRENT
SQL> recover database until time '2008-10-27:15:02:13';
:
:
Log applied.
Media recovery complete.
SQL>
SQL> alter database open resetlogs;
Database altered.
SQL>

All data after 27-10-08 15:02:13 will be lost.

Next Page »

Blog at WordPress.com.