Saturday, May 28, 2011

MoidIITDocID-502: How to create a password file? --Moid

$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='abc123' ignorecase=Y entries=5 force=y


Starting from 19c, atleast 8 bytes are required for SYS password.

orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='abc123'  force=y
OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters.

Solution is to add "format=12". See below:
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='abc123'  force=y  format=12


--Moid Muhammad

Monday, May 2, 2011

11g GoldenGate Installation (High Level steps) v1.4 --Moid

Very high level GG installation can be found from the following document.

Click here for the document.

--Moid





Golden Gate
GoldenGate
uni-directional
unidirectional
GG

Friday, March 18, 2011

Monday, February 28, 2011

10g RAC using openfiler (Jeff Hunter's Document)

Build Your Own 10g R2 Oracle RAC Cluster on Oracle Enterprise Linux and iSCSI Part-1
Build Your Own 10g R2 Oracle RAC Cluster on Oracle Enterprise Linux and iSCSI Part-2
Build Your Own 10g R2 Oracle RAC Cluster on Oracle Enterprise Linux and iSCSI Part-3


Also the cached pages are at my network at the following location:
\\192.168.0.61\lsi_shared_files\Build_10g_RAC_(Jeff_Hunter_Oracle_Document)

--Moid

Wednesday, February 2, 2011

How to change the protection mode from "maximum performance" to "maximum availability" in a 10g Data Guard environment?

Let's see how many different kind of protection modes Oracle offers in a Data Guard Environment.

Maximum Protection—This mode offers the highest level of data protection. Data is synchronously transmitted to the standby database from the primary database and transactions are not committed on the primary database unless the redo data is available on at least one standby database configured in this mode. If the last standby database configured in this mode becomes unavailable, processing stops on the primary database. This mode ensures no-data-loss.

Maximum Availability—This mode is similar to the maximum protection mode, including zero data loss. However, if a standby database becomes unavailable (for example, because of network connectivity problems), processing continues on the primary database. When the fault is corrected, the standby database is automatically resynchronized with the primary database.

Maximum Performance—This mode offers slightly less data protection on the primary database, but higher performance than maximum availability mode. In this mode, as the primary database processes transactions, redo data is asynchronously shipped to the standby database. The commit operation of the primary database does not wait for the standby database to acknowledge receipt of redo data before completing write operations on the primary database. If any standby destination becomes unavailable, processing continues on the primary database and there is little effect on primary database performance.

How to change from "maximum performance" to "maximum availability"? Click here for the instructions.

--Moid


Keywords:

Data Guard Protection Mode.

Wednesday, January 19, 2011

How to duplicate VMWare machine from an existing VMWare Machine v1.1

clicking here for the document..

--Moid Muhammad


Keyword: VMWare Cloning with screenshot, VMWare Duplicate, VMWare Oracle Database Cloning, step-by-step VMWare Cloning, VMWare image, VM Machine Image

Wednesday, December 29, 2010

11g R2 (11.2.0.2) -- Script to Auto Start/Shutdown databases during reboots.

I have a standalone 11 R2 (11.2.0.2) non-ASM database. The following is my script which can auto start/stop database and listener during system reboots. Please note that script reads /etc/oratab file to check which database to start. During startups, any database entry which has the "Y" at the end in the /etc/oratab file, will be started and anything which ends with "N", will be skipped.

Step 1:
Login as root and create a file called /etc/init.d/oracle. Add the following lines in the script.

#!/bin/bash

#######################################################################
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 98 34
# description: Startup/Shutdown script for 11g Oracle instances
#
#######################################################################

#######################################################################
#
# Note:
# cp $ORACLE_HOME/bin/dbstart $ORACLE_HOME/bin/dbstart.orig
# Make the following changes in $ORACLE_HOME/bin/dbstart
#
# Line#80 has the following:
# ORACLE_HOME_LISTNER=$1
#
# Replace it with the following two lines:
# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
# ORACLE_HOME_LISTNER=$ORACLE_HOME
#
# cp $ORACLE_HOME/bin/dbshut $ORACLE_HOME/bin/dbshut.orig
# Make the following changes in $ORACLE_HOME/bin/dbshut
#
# Line#50 has the following:
# ORACLE_HOME_LISTNER=$1
#
# Replace it with the following two lines:
# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
# ORACLE_HOME_LISTNER=$ORACLE_HOME
#
# save the file and proceed with the steps below
#
#######################################################################

#######################################################################
#Instructions to start start isntances manually
#
# To Start --> /etc/init.d/oracle start
# To Stop --> /etc/init.d/oracle stop
# To restrart --> /etc/init.d/oracle restart
#
#######################################################################

ORA_HM="/u01/app/oracle/product/11.2.0/db_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORA_HM/bin/dbstart -o ! -d $ORA_HM ]
then
echo "Oracle startup: cannot start"
exit 1
fi

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
start)
# starting Oracle instances
echo -n "starting Oracle Instances"
su - $ORA_OWNR -c $ORA_HM/bin/dbstart
touch /var/lock/subsys/oracle
ps -ef |grep pmon |grep -v grep
ps -ef |grep lsnr |grep -v grep
echo "OK"
;;
stop)

# Oracle listener and instance shutdown
su - $ORA_OWNR -c $ORA_HM/bin/dbshut
rm -f /var/lock/subsys/oracle
ps -ef |grep pmon |grep -v grep
ps -ef |grep lsnr |grep -v grep
echo "OK"
;;

reload|restart)
$0 stop
$0 start
ps -ef |grep pmon |grep -v grep
ps -ef |grep lsnr |grep -v grep
echo "OK"
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
clear
###################### END of SCRIPT ##############################


Step-2:
Change the permission of the script
chmod 750 /etc/init.d/oracle

Step-3:
Execute the following so that runlevel 3,4 & 5 will execute the script during system reboots.
chkconfig --level 345 oracle on

Step-4
Execute the script and verify everything is working as expected. Alternatively, you can download the script directory from here.


Additionally you can turn on and turn on with the following.
[root@bl-mm-db-dev ~]# /sbin/chkconfig oracle off
[root@bl-mm-db-dev ~]# /sbin/chkconfig --levels 345 oracle on

That's it. We are done.


--Moid

Tuesday, November 23, 2010

Oracle Support Policy and Product Expiration Dates

Details can be accessed from here.

--Moid




http://www.oracle.com/us/support/library/lifetime-support-technology-069183.pdf

How to mount the CDROM in Linux? --Moid

create an empty directory called /mnt/cdrom

[root@chicago /]# mkdir -p /mnt/cdrom
[root@chicago /]# mount -t iso9660 -r /dev/cdrom /mnt/cdrom
[root@chicago /]# cd /mnt/cdrom
[root@chicago /]# ls -ltr

to unmount

# umount /mnt/cdrom
# cd /
eject

--Moid



My page is here.

Monday, November 15, 2010

MIITDocID-916: How to find the biggest / Largest table (row wise) from a schema (or all schemas)? --Moid

Click here for the query.

--Moid

MIITDocID-919: How to find out the used size of the schema? --Moid

Click here for the SQL.

--Moid

How to check the current size (given and used) of the database?

Click here for the query.

--Moid

MoidIITDocID-637: How to find out the Oracle port numbers (used for isqlplus, DBConsole, Grid Control [OMS], OM agent etc)? --Moid

moid@Linux-223:(PrimeDG)$ cat $ORACLE_HOME/install/portlist.ini
iSQL*Plus HTTP port number =5561
iSQL*Plus HTTP port number =5560
Enterprise Manager Console HTTP Port (FlashDB) = 5501
Enterprise Manager Agent Port (FlashDB) = 1831
Enterprise Manager Console HTTP Port (kaleemdba) = 5502
Enterprise Manager Agent Port (kaleemdba) = 1832
Enterprise Manager Console HTTP Port (RecoCAT) = 5503
Enterprise Manager Agent Port (RecoCAT) = 3938
Enterprise Manager Console HTTP Port (STAR) = 5504
Enterprise Manager Agent Port (STAR) = 1830
Enterprise Manager Console HTTP Port (MarsDB) = 5500
Enterprise Manager Agent Port (MarsDB) = 1830
Enterprise Manager Console HTTP Port (alidb) = 5505
Enterprise Manager Agent Port (alidb) = 1831
Enterprise Manager Console HTTP Port (PrimeDG) = 5506
Enterprise Manager Agent Port (PrimeDG) = 3938
Enterprise Manager Console HTTP Port (TRYDB) = 5507
Enterprise Manager Agent Port (TRYDB) = 1832


Hope this helps.

--Moid

Wednesday, November 10, 2010

Wednesday, November 3, 2010

How to write DBID to alert long on a regular basis? --Moid

Every Oracle database has an internal unique DBID that can be queried from V$DATABASE
as follows:

SQL> select dbid from v$database;DBID------------------------------1794272723

RMAN uses the DBID to uniquely identify databases. The DBID helps RMAN identify the
correct RMAN backup piece from which to restore the control file. If you don’t use a flash
recovery area or a recovery catalog, then you should record the DBID in a safe location and
have it available in the event you need to restore your control file.


Writing the DBID to the Alert.log File

Another way of recording the DBID is to make sure that it is written to the alert.log file on a
regular basis using the DBMS_SYSTEM package. For example, you could have this SQL code execute as part of your backup job

COL dbid NEW_VALUE hold_dbidSELECT dbid FROM v$database;exec dbms_system.ksdwrt(2,'DBID: '||TO_CHAR(&hold_dbid));

After running the previous code, you should see a text message in your target database
alert.log file that looks like this:

==> alert_PrimeDG.log <==Wed Nov  3 03:06:47 2010DBID: 1794272723
You can easily put this in a cron job to write on a daily or weekly basis.Extracting of DBID from Redo Log fileAnother way of getting DBID is possible by getting the dump of the any availabe datafile, redolog or archvied log. I chosed to take a dumpfile of the online redolog and following are the steps I have taken.
SQL> ALTER SESSION SET sql_trace = true;Session altered.SQL> ALTER SESSION SET tracefile_identifier=Moid_Logfile_dump;Session altered.SQL> alter system dump logfile '/u15/oradata/Prime/redo01a.rdo';System altered.
At this point, I changed my directory to the user dump destination and dumpfile is available to be skinned.
Linux-223:(PrimeDG)$ pwd/u01/app/oracle/admin/PrimeDG/udumpLinux-223:(PrimeDG)$ ls -ltrhtotal 203M-rw-r-----  1 oracle oinstall  948 Nov  3 03:39 primedg_rfs_8676.trc-rw-r-----  1 oracle oinstall  947 Nov  3 03:44 primedg_rfs_8809.trc-rw-r-----  1 oracle oinstall 135M Nov  3 03:49 primedg_ora_8712.trc-rw-r-----  1 oracle oinstall  947 Nov  3 03:49 primedg_rfs_8979.trc-rw-r-----  1 oracle oinstall  68M Nov  3 03:49 primedg_ora_8712_MOID_LOGFILE_DUMP.trc
A simple cat of the file, provided me what I was looking for, DBID of my database.
Linux-223:(PrimeDG)$ cat primedg_ora_8712_MOID_LOGFILE_DUMP.trc |grep "Db ID"        Db ID=1794272723=0x6af26dd3, Db Name='PRIME'
--Moid
The above instructions can also be found here. 

Sunday, October 31, 2010

How to add a number to null in Oracle?

select ename, sal, comm, sal+COALESCE(comm,0) as total_compensation from emp;

Click here for the screenshot.

--Moid

Saturday, September 25, 2010

MIITDocID-904: How to check the root blocker (blocking session) and kill it?

Document can be found here.

--Moid

How to display the output of the query vertically?

Create a procedure called Print_Table as sys

It uses authid_current user so you can install it ONCE per database and many people can use it (with roles and all intact):

Procedure and display instructions are here.


Reference: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1035431863958
Google Key words: "Tom Kyte Print_Table"

--Moid

How to check the total “Used” and “Free” database space?

Here is a script to check the total "Used" and "Free" space in a database.

--Moid

Thursday, September 23, 2010

How to subscribe to free monthly edition of Oracle Magazine? --Moid

To subscribe Oracle Magazine, go here and select "Oracle Magazine" and follow the instructions. Or you can go directly to the subscription page by clicking here.

--Moid

Monday, September 20, 2010

Find the last recovery time/date of the Oracle database when "resetlogs" option was used to open the database (or when incarnation took place)?

Hi,

Have you ever been asked when was the database restored/reopened (with resetlog options)? It is a simple thing but sometimes a time consuming task especially if you are not very familiar with Oracle DBA dictionary or if you are a Jr. DBAs. Well, the answer can be found here. Hope this comes handy to someone in need.

--Moid


Keywords:

Last recovery date
Last restore date
Last recovery time
last restore time

Sunday, September 19, 2010

Friday, September 10, 2010

How to get the client's machine name and their IP Address in Oracle 10g?

Salam,

I was recently asked to spool out the client’s machine, their IP addresses and the service_name they are using to connect to RAC DB into a text file. I came up with the following queryand it worked like a charm. Although I tested it on a non-RAC db server, I have no doubt it will work on any RAC cluster.

--Moid

Tuesday, July 13, 2010

Followers