Friday, December 30, 2011

RMAN_restore_setname

run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
set newname for datafile 1 to '/u02/oradata/prod/system.dbf';
set newname for datafile 2 to '/u02/oradata/prod/undo.dbf';
set newname for datafile 3 to '/u02/oradata/prod/sysaux.dbf';
set newname for datafile 4 to '/u02/oradata/prod/users.dbf';
restore database;
switch datafile all;
recover database;
alter database open resetlogs;
release channel c1;
release channel c2;
}


SQL> alter database mount;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/kiwi/redo01.log' to '/u02/oradata/prod/redo01.log';

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/kiwi/redo02.log' to '/u02/oradata/prod/redo02.log';

Database altered.

SQL>

Saturday, December 17, 2011

How to change Virtual IP address on Oracle RAC..

[root@vm12 ~]# cd /u02/app/oracle/product/10.2.0/crs/bin/

[root@vm12 bin]# srvctl modify nodeapps -n vm11 -A 192.168.0.151/255.255.255.0/eth0

[root@vm12 bin]# ./srvctl stop nodeapps -n vm12
CRS-0210: Could not find resource 'ora.vm12.LISTENER_VM12.lsnr'.

[root@vm12 bin]# ./srvctl config nodeapps -n vm12 -a
VIP exists.: /vm12-priv.domain.com/192.168.1.52/255.255.255.0/eth0:eth1

[root@vm12 bin]# ./srvctl modify nodeapps -n vm12 -A 192.168.0.152/255.255.255.0/eth0

[root@vm12 bin]# ./srvctl config nodeapps -n vm12 -a
VIP exists.: /vm12-vip.domain.com/192.168.0.152/255.255.255.0/eth0

[root@vm12 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

Friday, November 11, 2011

Oracle Silent Installation...

./runInstaller -silent -ignorePrereq \
-responseFile /ora/Disk1/response/enterprise.rsp \
ORACLE_HOME=/u01/app/oracle/product/9.2.0 \
ORACLE_HOME_NAME=ORADB9i_Home1 \
n_configurationOption=3

version GLIBC_2.0 not defined in file libc.so.6 with link time reference (libzip.so)

DBCA error on 9i oracle RHEL 4....

Error:

[oracle@test1 bin]$ dbca
/u01/app/oracle/jre/1.1.8/bin/../lib/i686/green_threads/libzip.so: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference (libzip.so)
Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM
[oracle@test1 bin]$

Solution:

[oracle@test1 bin]$ LD_ASSUME_KERNEL=2.2.5
[oracle@test1 bin]$ export LD_ASSUME_KERNEL
[oracle@test1 bin]$ dbca

Saturday, November 5, 2011

How to drop/create Database Link from another schema?

SQL> CREATE or replace PROCEDURE scott.create_db_link AS
BEGIN
EXECUTE IMMEDIATE 'create database link LINK1 connect to scott identified by tiger using ''testdb''';
END create_db_link;
2 3 4 5
6 /

Procedure created.

SQL> show user
USER is "SYS"
SQL> exec scott.create_db_link

PL/SQL procedure successfully completed.

SQL> select * from dba_db_links where OWNER='SCOTT';

OWNER DB_LINK USERNAME HOST CREATED
------------------------------ -------------------- ------------------------------ -------------------- ---------
SCOTT LINK1 SCOTT testdb 04-NOV-11

SQL> drop database link scott.LINK1;
drop database link scott.LINK1
*
ERROR at line 1:
ORA-02024: database link not found


SQL> CREATE PROCEDURE scott.drop_db_link AS
BEGIN
EXECUTE IMMEDIATE 'drop database link LINK1';
END drop_db_link; 2 3 4
5 /

Procedure created.

SQL> exec scott.drop_db_link

PL/SQL procedure successfully completed.

SQL> select * from dba_db_links where OWNER='SCOTT';

no rows selected

SQL>

Friday, September 9, 2011

How to install JServer JAVA Virtual Machine

It allows to write Java stored procedures.

if JServer JAVA VM is not installed You will get error follwoing error
ERROR at line 1:
ORA-29538: Java not installed

Connect as sys user


SQL> @?/javavm/install/initjvm

SQL> select comp_name,status from dba_registry;

COMP_NAME STATUS
------------------------------------------------------------ -----------
Oracle Text VALID
Oracle XML Database VALID
Oracle Enterprise Manager VALID
Oracle Database Catalog Views VALID
Oracle Database Packages and Types VALID
JServer JAVA Virtual Machine VALID




Remove JVM:

SQL> @?/javavm/install/jvmrm.sql

How to install oracle text

SQL> @?/ctx/admin/catctx.sql oracle SYSAUX TEMP NOLOCK


sql> connect CTXSYS/oracle


SQL> @?/ctx/admin/defaults/dr0defin.sql "AMERICAN";

SQL> connect /as sysdba

SQL> alter user ctxsys account lock password expire;


SQL> select comp_name,version,status from dba_registry;

COMP_NAME VERSION STATUS
------------------------------------------------------------ ------------------------------ -----------
Oracle Text 10.2.0.5.0 VALID
Oracle XML Database 10.2.0.5.0 VALID
Oracle Enterprise Manager 10.2.0.5.0 VALID
Oracle Database Catalog Views 10.2.0.5.0 VALID
Oracle Database Packages and Types 10.2.0.5.0 VALID

SQL> select * from ctxsys.ctx_version;

VER_DICT VER_CODE
---------- ----------
10.2.0.5.0 10.2.0.5.0


SQL> select substr(ctxsys.dri_version,1,10) VER_CODE from dual;

VER_CODE
----------
10.2.0.5.0

SQL> select count(*) from dba_objects where owner='CTXSYS';

COUNT(*)
----------
339

SQL> select object_name, object_type, status from dba_objects where owner='CTXSYS' and status != 'VALID' order by object_name;

no rows selected

How to install XML DB

How to install XML DB

1. create tablespace for XDB

create tablespace xdb datafile '/u01/oradata/xdb.dbf' size 100m

2. Make sure sufficient Shared pool size

alter system set shared_pool_size = 180M scope=spfile;


3.Run script

@?/rdbms/admin/catqm password xdb temp

4. select comp_name,version,status from dba_registry;

5.Re install XML DB

@?/rdbms/admin/catnoqm
drop tablespace xdb including contents and datafiles;

TNS-12547: TNS:lost contact,Linux Error: 104: Connection reset by peer

Error:

TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer

Solution:

Make sure the loopback entry in /etc/hosts is not missing when you start the listener:
127.0.0.1 localhost.localdomain localhost
Now try to run lsnrctl start as oracle again.

Tuesday, September 6, 2011

Increase space on Linux thru VMware

How to increase space on VM Machine?

C:\Program Files\VMware\VMware Workstation>vmware-vdiskmanager.exe -x 20g "G:\Virtual Machines\TEST1\Red Hat Enterprise Linux 4.vmdk"


Below steps To increase disk size on Linux

[root@vm6 ~]# fdisk -l

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM


Disk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 512 524272 83 Linux

Disk /dev/sdc: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 512 524272 83 Linux

Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 261 2096451 83 Linux


$fdisk /dev/sda -----create primary partiotion

[root@vm6 ~]# fdisk -l

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
/dev/sda3 2611 3263 5245222+ 83 Linux

Disk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 512 524272 83 Linux

Disk /dev/sdc: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 512 524272 83 Linux

Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 261 2096451 83 Linux


*******************************************



[root@test1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
14G 9.8G 3.4G 75% /
/dev/sda1 99M 9.0M 85M 10% /boot
none 512M 98M 415M 20% /dev/shm
/dev/sdc1 380M 32M 329M 9% /backup
/dev/sdc3 304M 11M 279M 4% /tape
/dev/sdd1 5.0G 3.7G 1009M 79% /ora
shmfs 512M 98M 415M 20% /dev/shm
[root@test1 ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@test1 ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
[root@test1 ~]# lvextend -L+5G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 19.03 GB
Logical volume LogVol00 successfully resized
[root@test1 ~]# ext2online /dev/mapper/VolGroup00-LogVol00 ----->Linux 4

Note: # resize2fs /dev/mapper/VolGroup00-LogVol00 ----------->Linux 5

ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
[root@test1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
19G 9.8G 8.1G 56% /
/dev/sda1 99M 9.0M 85M 10% /boot
none 512M 98M 415M 20% /dev/shm
/dev/sdc1 380M 32M 329M 9% /backup
/dev/sdc3 304M 11M 279M 4% /tape
/dev/sdd1 5.0G 3.7G 1009M 79% /ora
shmfs 512M 98M 415M 20% /dev/shm
[root@test1 ~]#

Thursday, July 28, 2011

Solaris Commands

Solaris Command:

Version of Solaris:
# uname -r
5.10


#Determine whether package installed or not
# pkginfo -i SUNWarc
system SUNWarc Lint Libraries (usr)

# pkginfo -i SUNWsprox
ERROR: information for "SUNWsprox" was not found




# prtconf|grep "Memory size"
Memory size: 536 Megabytes
# /usr/sbin/swap -s

total: 218988k bytes allocated + 55636k reserved = 274624k used, 721404k available

# /bin/isainfo -kv

32-bit i386 kernel modules


Enable Network Card:

Enable the network card
#ifconfig e1000g0 plumb

Then issue the ifconfig -a Command

#ifconfig e1000g0 192.168.0.106 netmask 255.255.255.0 up

#ifconfig -a

Configuring Virtual interface

#ifconfig e1000g0:1 172.40.30.4 netmask 255.255.0.0 up


SSH Configuration User Equivalence Failed:

Workaround:

#mkdir -p /usr/local/bin
# ln -s /usr/bin/ssh /usr/local/bin
# ln -s /usr/bin/scp /usr/local/bin

Saturday, July 9, 2011

ORA-04063: package body "SYS.DBMS_REGISTRY_SYS" has errors while running utlrp...

SELECT dbms_registry_sys.time_stamp('utlrp_end') as timestamp from dual
*
ERROR at line 1:
ORA-04063: package body "SYS.DBMS_REGISTRY_SYS" has errors


BEGIN dbms_registry_sys.validate_components; END;

*
ERROR at line 1:
ORA-04063: package body "SYS.DBMS_REGISTRY_SYS" has errors
ORA-06508: PL/SQL: could not find program unit being called:
"SYS.DBMS_REGISTRY_SYS"
ORA-06512: at line 1


Solution:
1.shutdown immediate
2.startup upgrade
3.run catalog and catproc scritp
4.run utlrp
5.shutdown immediate
6.startup
7.select comp_name,version,status from dba_registry;

Monday, July 4, 2011

Avoid library file locking errors (libjox)

Hi,
When applying CPU or Patchsets you may encounter some errors with regards to files being locked or opatch being unable to copy files even though the databases, listeners and any other Oracle processes associated with the ORACLE_HOME to be patched were stopped. If you will apply patchset or CPU patches in Silent mode you cannot see Linking errors.

Work around:
we should following things while installing patchset

We should run slibclean as root user
genld -l grep /u01/app/oracle/product/10.2(Oralce_home)
genkld grep /u01/app/oracle/product/10.2(Oracle_Home)

If genld returns data then a currently executing process has something open in ORACLE_HOME directory, please terminate the process as required/recommended.

If genkld command returns a list of shared objects currently loaded onto the OS system cache then please remove the entries from the OS system cache by running the slibclean command as root;
/usr/sbin/slibclean

Prease verify once installation completed

Please Verify libjox file is updated or not
cd $ORACLE_HOME/lib
ls -lrt libj*
-rw-r----- 1 oracle dba 0 Aug 10 2005 libjox10.so
-rw-r--r-- 1 oracle dba 23177425 Mar 25 2008
libjmisc.so
-rw-r--r-- 1 oracle dba 4070303 May 10 2008 libjox10oraawt.so
-rw-r--r-- 1 oracle dba 13257611 May 10 2008 libjox10.a


so you will face following errors when running Catupgrd.sql script if libjox file not upadated

Error:
grant select on ALL_JOBS to public with grant option
*ERROR at line 1:ORA-03113: end-of-file on communication channel
and subsequently all the following sql statements fail
ERROR:ORA-03114: not connected to ORACLE


Please Refer Metalink Doc. ID 739963.1

Index Corruption(Partition)

Identify Coruppted Index using Block ID

SELECT SEGMENT_TYPE,OWNER'.'SEGMENT_NAMEFROM DBA_EXTENTS WHERE FILE_ID = 123 AND 15608 BETWEEN BLOCK_IDAND BLOCK_ID+BLOCKS -1;

Solution:

select INDEX_NAME,INDEX_OWNER,PARTITION_NAME,status,TABLESPACE_NAME from dba_ind_partitions where INDEX_NAMe like '%IND%';
select COLUMN_NAME,INDEX_NAME,TABLE_NAME from dba_ind_columns where INDEX_NAME= 'IND';
select INDEX_TYPE,TABLE_NAME,INDEX_NAME from dba_indexes where index_name= 'IND';
select sum(bytes/1024/1024) from dba_segments where SEGMENT_NAME= 'IND';
select SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_extents where SEGMENT_NAME= 'IND_TAB'
drop index scott. IND;
create index scott. IND on scott.IND_TAB (KEY_SEMRFORE93) tablespace users local;

Sunday, July 3, 2011

Error: ORA-16606: unable to find property,Warning: ORA-16826: apply service state is inconsistent with the DelayMins property

DGMGRL> show configuration

Configuration
Name: DRS
Enabled: YES
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
starprim - Primary database
starstby - Physical standby database

Current status for "DRS":
Warning: ORA-16608: one or more databases have warnings


DGMGRL> show configuration 'starprim'
Error: ORA-16606: unable to find property "starprim"
Warning: ORA-16826: apply service state is inconsistent with the DelayMins property


Error: ORA-16501: the Data Guard broker operation failed

DGMGRL> show configuration 'starstby'
Error: ORA-16606: unable to find property "starstby"
Warning: ORA-16826: apply service state is inconsistent with the DelayMins property


Error: ORA-16501: the Data Guard broker operation failed



DGMGRL> DGMGRL> show configuration 'starprim'
Error: ORA-16606: unable to find property "starprim"

Error: ORA-16501: the Data Guard broker operation failed

Solution:

DGMGRL> disable configuration
Disabled.
DGMGRL> enable configuration
Enabled.



DGMGRL> DGMGRL>
Configuration
Name: DRS
Enabled: YES
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
starprim - Primary database
starstby - Physical standby database

Current status for "DRS":
SUCCESS

Saturday, July 2, 2011

libXp.so.6: cannot open shared object file: No such file or directory occurred

Exception java.lang.UnsatisfiedLinkError: /tmp/OraInstall2008-01-07_04-37-54AM/jre/1.4.2/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory occurred..
java.lang.UnsatisfiedLinkError: /tmp/OraInstall2008-01-07_04-37-54AM/jre/1.4.2/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)


libXp.so.6: cannot open shared object file: No such file or directory

Check whether libXp package is installed or not

Solution:

rpm -q libXp
If it is not the install it.