Visit Counter

Showing posts with label Oracle 11g. Show all posts
Showing posts with label Oracle 11g. Show all posts

Tuesday, July 5, 2016

Upgrading the Recovery Catalog Schema OR Database




The catalog schema must support the highest target version it supports.  Therefore, when a target database is upgraded, you need to also upgrade the RMAN catalog schema.  Connect to RMAN from the target database (with highest version) and connect to the catalog schema to upgrade the schema version.  



Oracle Production DB Version  11.2.0.4
Oracle Catalog DB Version      10.2.0.4


Upgrade Catalog Schema

Production DB:


bash-4.1$ ./rman target / catalog rman/xxxxxxxx@catsserp


Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 9 17:02:43 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: SSAERP (DBID=3389811866)
connected to recovery catalog database
PL/SQL package RMAN.DBMS_RCVCAT version 10.02.00.04 in RCVCAT database is too old

RMAN> upgrade catalog;

recovery catalog owner is RMAN

enter UPGRADE CATALOG command again to confirm catalog upgrade



RMAN> upgrade catalog;

recovery catalog upgraded to version 11.02.00.04
DBMS_RCVMAN package upgraded to version 11.02.00.04
DBMS_RCVCAT package upgraded to version 11.02.00.04




Catalog DB


SQL> conn rman/xxxxxxx
Connected.


SQL> select * from rcver;

VERSION
------------
11.02.00.04



SQL> conn / as sysdba
Connected.


SQL> grant create type to rman;

Grant succeeded.






Tuesday, April 19, 2016

Oracle 11gR2 Patch 11.2.0.4 on Solaris



Download the ‘patch’ software

Login to Oracle support site.

  • Download the below patch .


  •  p13390677_112040_SOLARIS64_1of7 (Oracle Database, including Oracle RAC components)
  •  p13390677_112040_SOLARIS64_2of7 (Oracle Database, including Oracle RAC components)
  •  p13390677_112040_SOLARIS64_3of7 (Oracle Grid Infrastructure, includes: Oracle ASM, Oracle Clusterware, Oracle Restart)
  •  p13390677_112040_SOLARIS64_4of7 (Oracle Database Client)
  •  p13390677_112040_SOLARIS64_5of7 (Oracle Gateways)
  •  p13390677_112040_SOLARIS64_6of7(Oracle Examples)
  •  p13390677_112040_SOLARIS64_7of7 (Deinstall)

Once you’ve downloaded the software, unzip both files to a staging area:

$ unzip p13390677_112040_SOLARIS64_1of7  -d /ora/Desktop/db
$ unzip p13390677_112040_SOLARIS64_2of7  -d /ora/Desktop/db

All of the contents from the above will be extracted to a “database” directory.

$ /ora/Desktop/db/runInstaller

















# /u01/app/oralce/product/11.2.0.4/root.sh

[root@linux03 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
/u01/app/oracle/product/11.2.0.4/root.sh
[root@linux03 ~]# /u01/app/oracle/product/11.2.0.4/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME= /u01/app/oracle/product/11.2.0.4

Enter the full pathname of the local bin directory: [/usr/local/bin]: <enter>
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
Finally, back to the GUI, click close to finish, and you’re all done 
Goto to new oracle_home
./dbua










Tuesday, December 10, 2013

Upgrade Oracle11g Patch Set 11.2.0.3.0



Patch No 10404530         Oracle Database Family: Patchset
                                          11.2.0.3.0 Patch Set For Oracle Database Server



Download from below site.

https://updates.oracle.com/Orion/PatchDetails/process_form?patch_num=10404530&aru=14125322&plat_lang=226P&release=80112030&no_header=1





















Unzip the 1of7 & 2of7 files

$./runInstaller























































$ ORACLE_HOME=/oracle11/oraupgrade11
$ export ORACLE_HOME
$ ORACLE_SID=oratest
$ export ORACLE_SID

































Sunday, November 17, 2013

Duplicate Database Using RMAN



$ rman target sys/pwd@orasoft nocatalog auxiliary /

Recovery Manager: Release 10.2.0.2.0 - Production on Thu 01 Apr 14:35:00 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORASOFT (DBID=3746996829)
using target database control file instead of recovery catalog
connected to auxiliary database: ORADUP (not mounted)

RMAN> duplicate target database to oradup
2> pfile='/home/oracle/oracle/product/10.2.0/db_2/dbs/initdup.ora';

Starting Duplicate Db at 01-APR-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
contents of Memory Script:

{

set until scn 796992;
set newname for datafile 1 to
"/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/system01.dbf";
set newname for datafile 2 to
"/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/undotbs01.dbf";
set newname for datafile 3 to
"/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/sysaux01.dbf";
set newname for datafile 4 to
"/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/users01.dbf";
set newname for datafile 5 to
"/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/example01.dbf";
restore
check readonly
clone database
;
}

executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME

Starting restore at 01-APR-10
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/system01.dbf
restoring datafile 00002 to /home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/undotbs01.dbf
restoring datafile 00003 to /home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/sysaux01.dbf
restoring datafile 00004 to /home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/users01.dbf
restoring datafile 00005 to /home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/example01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/flash_recovery_area/ORASOFT/backupset/2010-04-
01/o1_mf_nnndf_TAG20120522T131351_7vpsq0ls_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/home/oracle/flash_recovery_area/ORASOFT/backupset/2010_04_01/o1_mf_nnndf_TAG2010522T131351_7vpsq0ls_.bkp tag=TAG20100401T131351
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36

Finished restore at 01-APR-10

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORADUP" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292

LOGFILE
GROUP 1 ( '//home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/redo01.log' ) SIZE 50 M REUSE,

GROUP 2 ( '//home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/redo02.log' ) SIZE 50 M REUSE,

GROUP 3 ( '//home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/redo03.log' ) SIZE 50 M REUSE

DATAFILE

'/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/system01.dbf'
CHARACTER SET WE8ISO8859P1

contents of Memory Script:

{

switch clone datafile all;

}

executing Memory Script

released channel: ORA_AUX_DISK_1

datafile 2 switched to datafile copy

input datafile copy recid=1 stamp=783959863 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy recid=2 stamp=783959863 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy recid=3 stamp=783959863 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/users01.dbf

datafile 5 switched to datafile copy

input datafile copy recid=4 stamp=783959863 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/example01.dbf



contents of Memory Script:

{

set until scn 796992;

recover

clone database

delete archivelog

;

}

executing Memory Script

executing command: SET until clause

Starting recover at 01-APR-10

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: sid=159 devtype=DISK

starting media recovery

archive log thread 1 sequence 3 is already on disk as file /home/oracle/archiev1/1_3_783781354.dbf

archive log filename=/home/oracle/archiev1/1_3_783781354.dbf thread=1 sequence=3

media recovery complete, elapsed time: 00:00:01

Finished recover at 01-APR-10

contents of Memory Script:

{

shutdown clone;

startup clone nomount pfile= '/home/oracle/oracle/product/10.2.0/db_2/dbs/initdup.ora';

}

executing Memory Script

database dismounted

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 608174080 bytes

Fixed Size 1281624 bytes

Variable Size 163578280 bytes

Database Buffers 436207616 bytes

Redo Buffers 7106560 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORADUP" RESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 ( '//home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/redo01.log' ) SIZE 50 M REUSE,

GROUP 2 ( '//home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/redo02.log' ) SIZE 50 M REUSE,

GROUP 3 ( '//home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/redo03.log' ) SIZE 50 M REUSE

DATAFILE

'/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/system01.dbf'

CHARACTER SET WE8ISO8859P1

contents of Memory Script:

{

set newname for tempfile 1 to

"/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/temp01.dbf";

switch clone tempfile all;

catalog clone datafilecopy "/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/undotbs01.dbf";

catalog clone datafilecopy "/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/sysaux01.dbf";

catalog clone datafilecopy "/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/users01.dbf";

catalog clone datafilecopy "/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/example01.dbf";

switch clone datafile all;

}

executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/temp01.dbf in control file

cataloged datafile copy

datafile copy filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/undotbs01.dbf recid=1 stamp=783959877

cataloged datafile copy

datafile copy filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/sysaux01.dbf recid=2 stamp=783959877

cataloged datafile copy

datafile copy filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/users01.dbf recid=3 stamp=783959877

cataloged datafile copy

datafile copy filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/example01.dbf recid=4 stamp=783959877

datafile 2 switched to datafile copy

input datafile copy recid=1 stamp=783959877 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy recid=2 stamp=783959877 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy recid=3 stamp=783959877 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/users01.dbf

datafile 5 switched to datafile copy

input datafile copy recid=4 stamp=783959877 filename=/home/oracle/oracle/product/10.2.0/db_2/oradata/oradup/example01.dbf


contents of Memory Script:

{

Alter clone database open resetlogs;

}

executing Memory Script

database opened

Finished Duplicate Db at 01-APR-10

RMAN>


Oracle Catalog Offline Backup Script


Oracle Catalog Offline Backup Script


Enviroment: Solaris 10 64-bit Sparc
                   Oracle DB 10.2.0





/opt/oracle10g

$ cat coldbk.sh

cd /opt/oracle10g/bin

rman target / nocatalog <<@

shutdown immediate;

startup mount;

run {

allocate channel ch1 type

disk format='/data1/db-offline/bk_%s_%p_%t';

backup (database);

release channel ch1;

startup;

}

 

 
$ ./coldbk.sh

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Jan 20 10:30:01 2011

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

connected to target database: CATDB (DBID=927922687)

using target database control file instead of recovery catalog

RMAN>

database closed

database dismounted

Oracle instance shut down

RMAN>

connected to target database (not started)

Oracle instance started

database mounted

Total System Global Area 612368384 bytes

Fixed Size 2042528 bytes

Variable Size 209720672 bytes

Database Buffers 394264576 bytes

Redo Buffers 6340608 bytes

RMAN> 2> 3> 4> 5> 6> 7>

allocated channel: ch1

channel ch1: sid=157 devtype=DISK

Starting backup at 20-Jan-2011

channel ch1: starting full datafile backupset

channel ch1: specifying datafile(s) in backupset

input datafile fno=00005 name=/opt/oracle10g/oradata/catdb/rmants.dbf

input datafile fno=00001 name=/opt/oracle10g/oradata/catdb/system01.dbf

input datafile fno=00003 name=/opt/oracle10g/oradata/catdb/sysaux01.dbf

input datafile fno=00002 name=/opt/oracle10g/oradata/catdb/undotbs01.dbf

input datafile fno=00006 name=/opt/oracle10g/oradata/catdb/system2.dbf

input datafile fno=00004 name=/opt/oracle10g/oradata/catdb/users01.dbf

channel ch1: starting piece 1 at 20-JAN-11

channel ch1: finished piece 1 at 20-JAN-11

piece handle=/data1/db-offline-bk/bk_157_1_784117842 tag=TAG20120524T

103042 comment=NONE

channel ch1: backup set complete, elapsed time: 00:01:25

channel ch1: starting full datafile backupset

channel ch1: specifying datafile(s) in backupset

including current control file in backupset

including current SPFILE in backupset

channel ch1: starting piece 1 at 20-JAN-11

channel ch1: finished piece 1 at 20-JAN-11

piece handle=/data1/db-offline-bk/bk_158_1_784117928 tag=TAG20120524T

103042 comment=NONE

channel ch1: backup set complete, elapsed time: 00:00:05

Finished backup at 20-JAN-11

released channel: ch1

database is already started

database opened

RMAN>

RMAN>

RMAN>



Recovery Manager complete.

$

Monday, August 26, 2013

Oracle 11g DB 64-bit Installation on Linux Suse ( Invalid source path specified for unzip)



Common Installation error.




Solution:

1. Download Oracle 11G Database.
2. Linux.x64_11gR2_Database_1of2.zip & Linux.x64_11gR2_Database_2of2.zip
3. Unzip both zipped files.
4. It will create to folders etc...database & database (2).
5.Goto to second folder etc...database (2)
6. Copy the following directories under below path.
/database (2)/stage/components/
oracle.ctx
oracle.jdk
oracle.owb.rsf
oracle.rdbms.install.seeddb
oracle.sysman.console.db

7. Paste all directories in below path.

/database/stage/components/

8. Run the installation.



Tuesday, April 30, 2013

Perform Flashback Query


Restore Dropped Tables from the Recycle Bin


The recycle bin is enabled by default.

SQL> ALTER SYSTEM SET recyclebin = ON;

To disable for the entire database (not recommended):

SQL> ALTER SYSTEM SET recyclebin = OFF;

To enable the recycle bin for a session:

SQL> ALTER SESSION SET recyclebin = ON;

To disable the recycle bin for a session:

SQL> ALTER SESSION SET recyclebin = OFF;


Show recyclebin contents

To see the objects in the recyclebin:

SHOW RECYCLEBIN

Clear recyclebin

To remove all dropped objects from the recyclebin (current user):

PURGE RECYCLEBIN;

To remove all dropped objects from the recyclebin (system wide):

PURGE DBA_RECYCLEBIN;

Tables can also be droped without sending them to the recyclebin. Example:

DROP TABLE t1 PURGE;
Examples

Drop a table:

SQL> DROP TABLE t1;
      drop the table:

SQL> FLASHBACK TABLE t1 TO BEFORE DROP;

Monday, April 29, 2013

Migrating SQL Server to Oracle 11.2 using SQL Developer 3.2




Environment:

Microsoft SQL Server 2008
Oracle Database 11.2 on Linux 32-bit
SQL Developer 3.2


Download driver for JDBC.
http://www.oracle.com/technetwork/developer-tools/sql-developer/thirdparty-095608.html

Tools Menu --> Preferences --> Database -->Third Party JDBC Drivers -->
add Entry --> C:\jdbc\jtds-1.2.jar