Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Wednesday, January 04, 2012

Oracle 11g Interactive Quick Reference guide

 

I just came across an essential Oracle 11g Interactive Quick Reference guide – which has the key dictionary views, background processes and architecture diagram.
Hope you may find it useful.  It can be downloaded from

http://www.oracle.com/webapps/dialogue/ns/dlgwelcome.jsp?p_ext=Y&p_dlg_id=9575302&src=7027600&Act=54

Sunday, January 01, 2012

RMAN-06169: could not read file header for datafile nn error reason 4

 

RMAN-06169: could not read file header for datafile nn error reason 4
RMAN-06169: could not read file header for datafile nn error reason 4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/20/2011 07:41:54
RMAN-06056: could not access datafile nn

The reason code of 4 meant for DBWR could not find the file. After investigating found that the new data file added on locally for a RAC database. That data file not available on other node cause this backup failure.

To resolve this, the locally create data file moved to ASM.

Friday, October 14, 2011

Moving Data files Between ASM Disk Groups

 

Method 1: Using RMAN

Step 1: Start RMAN and connect to the target database.

$ rman target /

Step 2: Generate a report that shows the names of the datafiles.

RMAN> REPORT SCHEMA;

Step 3:  Back up the datafile to the new ASM disk group.

RMAN> BACKUP AS COPY DATAFILE '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' FORMAT '+DG_DEVSYS_mydb1_DATA_01';

Step 4:  Bring the Datafile Offline
alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 5: Point the control file to the newly created copy of the datafile

RMAN> SWITCH DATAFILE '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' TO COPY;

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online

Step 8. Delete the old datafile
RMAN>DELETE DATAFILECOPY “DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421”

Reference: http://download.oracle.com/docs/cd/B28359_01/backup.111/b28270/rcmasmmi.htm

Method 2: Using ASMCMD CP ( Copy ) Command

Step 1: Start RMAN and connect to the target database.

$ rman target /

Step 2: Generate a report that shows the names of the datafiles.

RMAN> REPORT SCHEMA;

Step 3:  Bring the Datafile Offline
alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 4:  Connect to ASMCMD and use CP to copy files
$ asmcmd –p

ASMCMD [+] > cp +DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421 +DG_DEVSYS_mydb1_DATA_01

Step 5:  After copied datafile, then rename file in database.  With ASM(OMF) this delete old datafile.

alter database rename file '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421'  to '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767'

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online

Step 8: Verify the file name
RMAN> REPORT SCHEMA


Method 3:  Using RMAN Copy

Step 1:  Restrict the Session
ALTER SYSTEM enable restricted session;

Step 2:   Bring the Datafile Offline

alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 3: Start RMAN and connect to the target database.

$ rman target /

Step 4:  RMAN Copy datafile
RMAN> copy datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' to '+DG_DEVSYS_mydb1_DATA_01';

Step 5:  After copied datafile, then rename file in database.  With ASM(OMF) this delete old datafile.

alter database rename file '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421'  to '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767'

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online


Step 8: Verify the file name
RMAN> REPORT SCHEMA

Step 9: Disable the Restricted Session

ALTER SYSTEM disable restricted session;

Saturday, September 17, 2011

Sequence of steps performed when opening up a database

After issuing of SHUTDOWN ABORT command, when opening up database following step are performed

1. SPFile / PFile:             Server Parameter file ( SP File ) or the initialization parameter (initSID.ora / PFILE ) file is read
2. Memory :                      SGA is allocated
3. Background Process: Background process are started
4. Control File :                Control file is read
5. Redo Log File:              Redo Log file is read
6. Data File:                       Data files are checked for consistency
7. Instance Recovery:   Instance Recovery is started

Friday, July 15, 2011

How to delete control file


 

Verify the file specification information for the current control file(s):

SQL> show parameters control_files

If your are using pfile, change CONTROL_FILES to point to the remaining control files. Make sure that the full file specification is used.

vi $ORACLE_HOME/dbs/init<SID>.ora.

CONTROL_FILES = (/oradata/<sid>/data1/control_01.ctl, /oradata/<sid>/data3/control_02.ctl)

If you are using spfile, you may modify the CONTROL_FILES parameter using the ALTER SYSTEM SET command.

SQL> alter system set control_files = /oradata/<sid>/data1/control_01.ctl, /oradata/<sid>/data3/control_02.ctl scope=spfile;

Shutdown and startup the database.

Verify the file specification information for the current control file(s):

SQL> show parameters control_files

If desired, delete the control file from the O/S.

Tuesday, June 28, 2011

Steps to set database on flashback mode in RAC for Oracle 11g

 

---- Check if flashback on?

SELECT flashback_on, log_mode
FROM v$database;

--- Check for Flashback Parameters existing

set linesize 121
col name format a30
col value format a30

SELECT name, value
FROM gv$parameter
WHERE name LIKE '%flashback%';

---- Stop the RAC Database , it will stop all the instances of the DB

srvctl stop database -d sfodb

--- Start the DB in mount state

srvctl start instance -d sfodb -i sfo38u1 -o mount 

-- Set the Flashback on

alter database flashback on;

--- Open the database

alter database open;

--- Start the remaining instances of the RAC

srvctl start instance -d sfodb -i sfo38u2 -o mount exclusive

-- Verify the flashback settings

select INST_ID,Name, FLASHBACK_ON from gv$database;

Sunday, May 29, 2011

What is mounting the databases in Oracle?

After starting the instance, the Oracle software associates the instance with specific database. This is called mounting the database.

Monday, May 23, 2011

Oracle Database Storage Structure

 

Oracle DB Storage Structure

image

Relationship of Database, Tablespace and Data files

image

 

How table data is stored in Oracle Database

image

Content of Database Data Block

image