Tuesday, December 15, 2009

Oracle 11g installation on sun solaris10

1)Create groups for Oracle account
#groupadd oinstall
#groupadd dba
#groupadd oper
2)Create Oracle Default Home directory
# mkdir /export/home
# mkdir /export/home/oracle
3)Create Oracle user
# useradd -g oinstall -G dba -d /export/home/oracle -s /usr/bin/bash oracle
# chown oracle:oinstall /export/home/oracle
4)Create Project for Oracle for setting the kernel parameters
In case of Solaris 10, you can use projects to configure the kernel parameters instead of /etc/system file. This can be done as following
# projadd -U oracle -K "project.max-shm-memory=(priv,4g,deny)" oracle
# projmod -sK "project.max-sem-nsems=(priv,256,deny)" oracle
# projmod -sK "project.max-sem-ids=(priv,100,deny)" oracle
# projmod -sK "project.max-shm-ids=(priv,100,deny)" oracle
There are many more ways of creating project entries such as group.group-name or user.user-name .

prctl -n project.max-sem-ids -i task `ps -o taskid= -p $$`
5)Create .bash_profile for Oracle user
#Oracle Environment Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u03/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME
ORACLE_SID=TESTDB11G; export ORACLE_SID
PATH=$PATH:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin:$ORACLE_HOME/bin
Now Set the Display to a X-windowing enabled system.
$ export DISPLAY=192.168.4.47:0.0
Also allow the host to accept the connection by
$xhost +
Oracle Software Installation
Go to the Oracle dump location and run runInstaller as Oracle user
$./runInstaller
This will open Oracle Universal Installer(OUI) screen. If Oracle Universal Installer is not displayed, then ensure DISPLAY variable is set correctly. Select “Software only” option and install the software. If any of the pre-requisite’s are not met , then installation will fail. You would be required to make necessary changes to proceed.
Database Creation
We will be using ASM for the Database files. For this we need to perform some configuration
1)Prepare the Raw device for using as ASM Disks
# ls -l
total 0
crw------- 1 root root 125, 1 Jun 20 10:39 1
Disk should be owned by Oracle user and should have permission set to 660
# chown oracle:dba 1
# chmod 660 1

- # ls -ltr
total 0
crw-rw---- 1 oracle dba 125, 1 Jun 20 10:39 1
2)Configure CSS Service

3) Configure ASM Instance
a)Go to $ORACLE_HOME/bin
b)Execute dbca from this directory (ensure dbca is properly set)
$./dbca
c) Select Configure ASM Instance option. This will create ASM instance for you. After this you can create Diskgroups using GUI or else use sqlplus to do the same.
4)Now continue creating database normally and enter Diskgroup Name after selecting Oracle Managed files as database file location.
While you navigate through GUI screens, it will prompt you to Specifying Security Settings
- Keep the enhanced 11g security settings(recommended)
- Revert to pre 11g settings
Select the 11g settings which will enable Auditing by default and also enable Case sensitive passwords with Stronger password hashing algorithm.
• I have not discussed GUI screens for DBCA and OUI in this article. These are pretty much standard screens. In case you need more information about it, then you can refer to

Oracle 10g installation on sun solaris10

#/usr/sbin/prtconf | grep “Memory size” [Check RAM size]
# /usr/sbin/swap -s [check swap]
# df -k /tmp [check /tmp size (>400mb)]
# uname -r [check solaris version]
# pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibm SUNWlibms SUNWsprot SUNWsprox SUNWtoo SUNWi1of SUNWi1cs SUNWi15cs SUNWxwfnt
# cat /etc/nsswitch.conf | grep hosts
# hostname
# domainname
RUN INSTALL:
—————-
A. create group name “dba”, oracle inventory group “oinstall” and “oracle” user
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
{Determine oracle user exist or not
# id -a oracle
{if exist, should be look like this=
uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)
{create oracle user=
# useradd -d /export/home/oracle -g dba -G oinstall -m -s /bin/ksh oracle
#mkdir /export/home/oracle
#chown oracle:dba /export/home/oracle
{set password=
# passwd -r files oracle
{to determine nobody user=
# id nobody
# /usr/sbin/useradd nobody >>run if does not exist
B. EDIT FILE /export/home/oracle/.profile
————————————–
umask 022
TMP=/tmp
TMPDIR=$TMP
DISPLAY=localhost:0.0
export TMP TMPDIR DISPLAY
ORACLE_BASE=/u01/app/oracle [replace with ur Oracle base Directory]
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 [replace with ur Oracle home Directory]
ORACLE_SID=jktdb [replace with your database]
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
C. Configure Kernel Parameter
—————————–
Note: Do not follow the official installation instruction, they contain misleading and out errors of fact!
#projadd oracle [This command will create a new 'resource project']
edit the /etc/user_attr file:
adm::::profiles=Log Management
lp::::profiles=Printer Management
root::::auths=solaris.*,solaris.grant;profiles=Web Console Management,All;lock_after_retries=no
oracle::::project=oracle [add this line]
then:
#su – oracle
$ id -p
$ prctl -n project.max-shm-memory -i project oracle
The display look like this:
project: 100: oracle
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
project.max-shm-memory
privileged 126MB – deny -
system 16.0EB max deny -
leaving the oracle user still connected in the original one Then, as root in the new terminal, you can issue this command:
#prctl -n project.max-shm-memory -v 4gb -r -i project oracle [create max memory to 4GB]
As soon as you’ve issued that command, switch back to the oracle user’s session and re-issue the earlier command:
$ prctl -n project.max-shm-memory -i project oracle
Note:
#prctl -n project.max-shm-memory -v 4gb -r -i project oracle [this setting will lost after reboot]
to set permanently, run this: #projmod -s -K “project.max-shm-memory=(priv,4gb,deny)” oracle
D. Performing the Oracle Installation
————————————-
#su – oracle
$xhost +
$export DISPLAY=localhost;0.0
$ xhost + >>run this if you install from remote PC
$ cd /export/home/database/ [the source unzipped here]
./runInstaller
FOR SOLARIS SPARC:
====================
$ gunzip ship_rel10_sol64_db.cpio.gz
$ cpio -idm < ship_rel10_sol64_db.cpio $./runInstaller If you found unsufficient SWAP disk space on your disk, create folder under / then run this command: ————————————————— $ TMP=/directory $ TMPDIR=/directory $ export TMP TMPDIR Follow the screen>>NEXT>>NEXT
last, run this as root user:
—————————-
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/10.2.0/db_1/root.sh
Create db:
———-
orc1
jktdb
E. 6.0 On-going Administration
——————————–
Finally, it’s time to get the web-based Enterprise Manager database administration tool up and running.
Since we’re using 10g Release 2, you should be able to launch a browser (Launch -> Web Browser) and simply navigate to : http://localhost:1158/em
If you do not know the correct port number to use, look for the following line in the $ORACLE_HOME/install/portlist.ini file.
in order to be able to log on as SYS with a password of whatever you supplied to the first screen of the Oracle installation wizard. In fact, getting a meaningful result at this point relies on three things having been performed successfully:
1. starting a listener (lsnrctl start)
2. opening the database (sqlplus / as sysdba then startup)
3. starting the Enterprise Manager agent (emctl start dbconsole)
F. Automating Database Startup
———————————————–
edit file “/var/opt/oracle/oratab” script to find lines with ‘Y’ at their ends
Create file “/etc/init.d/dbora”
——-
#!/bin/sh
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo “Oracle startup: cannot start”
exit
fi
case “$1? in
’start’)
su – $ORA_OWNER -c “$ORA_HOME/bin/dbstart”
;;
’stop’)
su – $ORA_OWNER -c “$ORA_HOME/bin/dbshut”
;;
esac
———
#chmod 777 /etc/init.d/dbora
#/etc/init.d/dbora stop
To integrate dbora file to standart Solaris startup and shutdown process:
————————————————————————
#ln -s /etc/init.d/dbora /etc/rc0.d/K01dbora
#ln -s /etc/init.d/dbora /etc/rc2.d/S99dbora
IF u found error this:
———————–
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
edit file “dbstart” & “dbshut”, find line $ORACLE_HOME_LISTNER=$1
and change to = $ORACLE_HOME_LISTNER=/u01/app/oracle/product/10.2.0/db_1
RECOMMENDED DIRECTORY STRUCTURE:
———————————————-
[Oracle Base Directory:]
/u01/app/oracle
/u01/app/orauser
/opt/oracle/app/oracle
[Oracle Inventory Directory:]
ORACLE_BASE/oraInventory
[Oracle Home Directory:]
ORACLE_BASE/product/10.2.0/db_1
[Identify an existing oracle base directory:]
#more /var/opt/oracle/oraInst.loc
[the output should be:]
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall
# more /var/opt/oracle/oratab
*:/u03/app/oracle/product/10.2.0/db_1:N
*:/opt/orauser/infra_904:N
*:/oracle/9.2.0:N
COMMON INSTALLATION ERROR:
===========================
Unable to convert from “UTF-8? to “646? for NLS!
Solution: Install SUNWuiu8 package.
error adduser:
———————
UX: useradd: ERROR: Inconsistent password files. See pwconv(1M)
This is because the /etc/passwd and /etc/shadow files are out of synchronization on your machine. [CSCdi74894]
To fix this, run the pwconv command, and then rerun cwconfigure.
try to run:
wc -l /etc/passwd /etc/shadow
————–
ERROR Checking monitor: must be configured to display at least 256 colors >>> Could not execute auto check for
display colors using command /usr/openwin/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
Some requirement checks failed. You must fulfill these requirements before continuing with theinstallation, at which time they will be rechecked.
Solution(s):
1. Install SUNWxwplt package
2. Set DISPLAY variable
3. Execute xhost + on target (set in DISPLAY) computer
———————————————————-
Exception in thread “main” java.lang.UnsatisfiedLinkError:
… libmawt.so: ld.so.1: java: fatal: libXm.so.4: open failed: No such file or directory
Solution: Install the SUNWmfrun package.
—————————————————————————————————-
Can’t load ‘/usr/perl5/5.8.4/lib/i86pc-solaris-64int/auto/Sun/Solaris/Project/Project.so’ for module
Sun::Solaris::Project: ld.so.1: perl: fatal: libpool.so.1: open failed: No such file or directory at
/usr/perl5/5.8.4/lib/i86pc-solaris-64int/DynaLoader.pm line 230. at /usr/sbin/projadd line 19 Compilation
failed in require at /usr/sbin/projadd line 19. BEGIN failed–compilation aborted at /usr/sbin/projadd line 19.
Solution: Install the SUNWpool SUNWpoolr packages.
———————————————————————–
bash-3.00$ /u01/app/oracle/product/10.2.0/db_1/bin/./emctl start dbconsole
Exception in getting local host
java.net.UnknownHostException: -a: -a
at java.net.InetAddress.getLocalHost(InetAddress.java:1191)
at oracle.sysman.emSDK.conf.TargetInstaller.getLocalHost(TargetInstaller.java:4977)
at oracle.sysman.emSDK.conf.TargetInstaller.main(TargetInstaller.java:3758)
Exception in getting local host
Solution : check server hostname and /etc/hosts
————————————————————————-
UNINSTALL ORACLE 10G:
———————
1. remove all database, by running $dbca
2. stop any oracle process running:
Database Control : $ORACLE_HOME/bin/emctl stop dbconsole
Oracle Net listener : $ORACLE_HOME/bin/lsnrctl stop
iSQL*Plus : $ORACLE_HOME/bin/isqlplusctl stop
Ultra Search : $ORACLE_HOME/bin/searchctl stop
3. Start Oracle Universal installer:
$ORACLE_HOME/oui/bin/runInstaller
4. In the Welcome window, click Deinstall Products.
5. In the Inventory screen, select the Oracle home and the products that you want to remove,

Oracle DBA Interview questions

•What is the database holding Capacity of Oracle ?
Why in 10G, when you use real time apply feature in conjunction with Maximum Protection, you can achive

You have taken import of a table in a database. you have got the Integrity constraint violation error.
what are the diffrent file types that are supported by SQL*Loader?
How to find how many database reside in Oracle server in query?
Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given
What spfile/init.ora file parameter exists to force the CBO to make the execution path of a given statement
HOW 2 ENABLE PARTITIONING FEAUTURE IN ORACLE 8i
How many memory layers are in the shared pool?
What are the attributes of the Virtual Indexes
Virtual Indexes in Oracle
What are materialized views? when are they used?
What is a functional index - explain?
Where we use bitmap index ?
What is an extent
How to you move from Dedicated server Process to a Shared Server Process
What are the components of physical database structure of Oracle database
What are the components of logical database structure of Oracle database
How can be determine the size of the log files
How can be determine the size of the database?
How can you check which user has which Role
Can you start a database without SPfile in oracle 9i?
Do a view contain data
Can objects of the same schema reside in different tablespaces
can we create index on long raw column?
What are the basic element of base configuration of an Oracle database
What is the function of redo log
Linux administration
•Q. How do you list files in a directory?
How do you list all files in a directory, including the hidden files?

How do you find out all processes that are currently running?

How do you find out the processes that are currently running or a particular user?

How do you kill a process?

What would you use to view contents of the file?
What would you use to edit contents of the file?

What would you use to view contents of a large error log file?
How do you log in to a remote Unix box?

How do you get help on a UNIX terminal?

How do you list contents of a directory including all of its
subdirectories, providing full details and sorted by modification time

Auditing oracle server

Auditing is a default feature of the Oracle server. The initialization parameters that influence its behaviour can be displayed using the SHOW PARAMETER SQL*Plus command.
SQL> SHOW PARAMETER AUDIT

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string C:\ORACLE\PRODUCT\10.2.0\ADMIN
\DB10G\ADUMP
audit_sys_operations boolean FALSE
audit_trail string NONE
SQL>
Auditing is disabled by default, but can enabled by setting the AUDIT_TRAIL static parameter, which has the following allowed values.
AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }
The following list provides a description of each setting:
•none or false - Auditing is disabled.
•db or true - Auditing is enabled, with all audit records stored in the database audit trial (SYS.AUD$).
•db,extended - As db, but the SQL_BIND and SQL_TEXT columns are also populated.
•xml- Auditing is enabled, with all audit records stored as XML format OS files.
•xml,extended - As xml, but the SQL_BIND and SQL_TEXT columns are also populated.
•os- Auditing is enabled, with all audit records directed to the operating system's audit trail.
Note. In Oracle 10g Release 1, db_extended was used in place of db,extended. The XML options are new to Oracle 10g Release 2.

The AUDIT_SYS_OPERATIONS static parameter enables or disables the auditing of operations issued by users connecting with SYSDBA or SYSOPER privileges, including the SYS user. All audit records are written to the OS audit trail.

The AUDIT_FILE_DEST parameter specifies the OS directory used for the audit trail when the os, xml and xml,extended options are used. It is also the location for all mandatory auditing specified by the AUDIT_SYS_OPERATIONS parameter.

To enable auditing and direct audit records to the database audit trail, we would do the following.
SQL> ALTER SYSTEM SET audit_trail=db SCOPE=SPFILE;

System altered.

SQL> SHUTDOWN
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.

Total System Global Area 289406976 bytes
Fixed Size 1248600 bytes
Variable Size 71303848 bytes
Database Buffers 213909504 bytes
Redo Buffers 2945024 bytes
Database mounted.
Database opened.
SQL>

UX: useradd: ERROR: Inconsistent password files. See pwconv(1M).

pwconv- installs and updates /etc/shadow with information from /etc/passwd
SYNOPSIS
pwconv
DESCRIPTION
The pwconv command creates and updates /etc/shadow with information from /etc/passwd.
pwconv relies on a special value of 'x' in the password field of /etc/passwd. This value of 'x' indicates that the password for the user is already in /etc/shadow and should not be modified.
If the /etc/shadow file does not exist, this command will create /etc/shadow with information from /etc/passwd. The command populates /etc/shadow with the user's login name, password, and password aging information. If password aging information does not exist in /etc/passwd for a given user, none will be added to /etc/shadow. However, the last changed information will always be updated.
If the /etc/shadow file does exist, the following tasks will be performed:
Entries that are in the /etc/passwd file and not in the /etc/shadow file will be added to the /etc/shadow file.
Entries that are in the /etc/shadow file and not in the /etc/passwd file will be removed from /etc/shadow.
Password attributes (for example, password and aging information) that exist in an /etc/passwd entry will be moved to the corresponding entry in /etc/shadow.
The pwconv command can only be used by the super-user.
FILES
/etc/opasswd
/etc/oshadow
/etc/passwd
/etc/shadow