Saturday, August 29, 2009

Using pipe to Export/Import large files of > 2gb

Source:-
http://www.idevelopment.info/data/Oracle/DBA_tips/Export_Import/EXP_2.shtml
Example: (Using Compress and Split)

Export
#!/bin/ksh

# +---------------------------------------+
# | Change directory to the EXPORT_DIR. |
# +---------------------------------------+
cd /u03/app/oradata/TESTDB/export
pwd

# +---------------------------------------+
# | Remove previous pipes (if any) |
# +---------------------------------------+
rm -f compress_pipe
rm -f export_pipe

# +---------------------------------------+
# | Make two new pipes (Compress / Split) |
# +---------------------------------------+
mknod compress_pipe p
mknod export_pipe p
chmod 666 export_pipe compress_pipe

# +---------------------------------------+
# | Start both the Split and Compress |
# | backgroud processes. |
# +---------------------------------------+
nohup split -b 1024m < export_pipe &
nohup compress < compress_pipe > export_pipe &

# +---------------------------------------+
# | Finally, start the export to both |
# | pipes. |
# +---------------------------------------+
exp userid=system/manager file=compress_pipe full=yes log=exportTESTDB.log

# +---------------------------------------+
# | Remove the pipes. |
# +---------------------------------------+
rm -f compress_pipe
rm -f export_pipe
Import
#!/bin/ksh
# +---------------------------------------+
# | Change directory to the EXPORT_DIR. |
# +---------------------------------------+
cd /u03/app/oradata/TESTDB/export
pwd

# +---------------------------------------+
# | Remove previous pipe (if any) |
# +---------------------------------------+
rm -f import_pipe

# +---------------------------------------+
# | Make two new pipes (Compress / Split) |
# +---------------------------------------+
mknod import_pipe p
chmod 666 import_pipe

# +---------------------------------------+
# | Start both the Uncompress |
# | backgroud processes. |
# | This example assumes the export script|
# | (above) created three dump files xaa, |
# | xab and xac. |
# +---------------------------------------+
nohup cat xaa xab xac | uncompress - > import_pipe &

imp userid=system/manager file=import_pipe full=yes ignore=yes log=importTESTDB.log

# +---------------------------------------+
# | Remove the pipe. |
# +---------------------------------------+
rm -f import_pipe

Example: (Using only Split)

Export
#!/bin/ksh

# +---------------------------------------+
# | Change directory to the EXPORT_DIR. |
# +---------------------------------------+
cd /u03/app/oradata/TESTDB/export
pwd

# +---------------------------------------+
# | Remove previous pipes (if any) |
# +---------------------------------------+
rm -f export_pipe

# +---------------------------------------+
# | Make new pipe (Split) |
# +---------------------------------------+
mknod export_pipe p
chmod 666 export_pipe

# +---------------------------------------+
# | Start the Split backgroud process. |
# +---------------------------------------+
nohup split -b 1024m < export_pipe &

# +---------------------------------------+
# | Finally, start the export to the pipe.|
# +---------------------------------------+
exp userid=system/manager file=export_pipe full=yes log=exportTESTDB.log

# +---------------------------------------+
# | Remove the pipe. |
# +---------------------------------------+
rm -f export_pipe
Import
#!/bin/ksh
# +---------------------------------------+
# | Change directory to the EXPORT_DIR. |
# +---------------------------------------+
cd /u03/app/oradata/TESTDB/export
pwd

# +---------------------------------------+
# | Remove previous pipe (if any) |
# +---------------------------------------+
rm -f import_pipe

# +---------------------------------------+
# | Make new pipe (Split) |
# +---------------------------------------+
mknod import_pipe p
chmod 666 import_pipe

# +---------------------------------------+
# | Start the Split backgroud processes. |
# | This example assumes the export script|
# | (above) created three dump files xaa, |
# | xab and xac. |
# +---------------------------------------+
nohup cat xaa xab xac > import_pipe &

imp userid=system/manager file=import_pipe full=yes ignore=yes log=importTESTDB.log

# +---------------------------------------+
# | Remove the pipe. |
# +---------------------------------------+
rm -f import_pipe

Example: (Using only Compress)

Export
#!/bin/ksh

# +---------------------------------------+
# | Change directory to the EXPORT_DIR. |
# +---------------------------------------+
cd /u03/app/oradata/TESTDB/export
pwd

# +---------------------------------------+
# | Remove previous pipes (if any) |
# +---------------------------------------+
rm -f export_pipe

# +---------------------------------------+
# | Make new pipe (for gzip) |
# +---------------------------------------+
mknod export_pipe p
chmod 666 export_pipe

# +---------------------------------------+
# | Start the gzip backgroud process. |
# +---------------------------------------+
nohup cat export_pipe | gzip -9 > expdat.dmp.gz &

# +---------------------------------------+
# | Finally, start the export to the pipe.|
# +---------------------------------------+
exp userid=system/manager file=export_pipe full=yes log=exportTESTDB.log

# +---------------------------------------+
# | Remove the pipe. |
# +---------------------------------------+
rm -f export_pipe
Import
#!/bin/ksh
# +---------------------------------------+
# | Change directory to the EXPORT_DIR. |
# +---------------------------------------+
cd /u03/app/oradata/TESTDB/export
pwd

# +---------------------------------------+
# | Remove previous pipe (if any) |
# +---------------------------------------+
rm -f import_pipe

# +---------------------------------------+
# | Make new pipe (for gzip) |
# +---------------------------------------+
mknod import_pipe p
chmod 666 import_pipe

# +---------------------------------------+
# | Start the gzip backgroud processes. |
# | This example assumes the export script|
# | (above) created a dump file named |
# | expdat.dmp.gz. |
# +---------------------------------------+
nohup gunzip -c expdat.dmp.gz > import_pipe &

imp userid=system/manager file=import_pipe full=yes ignore=yes log=importTESTDB.log

# +---------------------------------------+
# | Remove the pipe. |
# +---------------------------------------+
rm -f import_pipe

Friday, August 21, 2009

How to check nodenames,interconnect,subnet in RAC 10G

olsnodes -n -p -i
asdf1 1 asdf1-rac asdf1-vip
asdf2 2 asdf2-rac asdf2-vip


oifcfg getif
eth0 192.168.141.144 global public
eth2 192.168.146.128 global cluster_interconnect


srvctl config nodeapps -n asdf1 -a
VIP exists.: /asdf1-vip/192.168.141.152/255.255.255.240/eth0


This info can be matched with /etc/hosts and /sbin/ifconfig -a

Troubleshooting sqlplus "/ as sysdba" not working issues

There can be many reasons some of them listed below:
------------------------------------------------------
1)bash-3.00$ cd $ORACLE_HOME/rdbms/lib
bash-3.00$ ls -altr config*
-rw-r----- 1 oracle oracle 260 Jul 6 23:27 config.c
-rw-r----- 1 oracle oracle 1216 Jul 6 23:52 config.o
bash-3.00$ cat config.c
/* SS_DBA_GRP defines the UNIX group ID for adminstrative access. */
/* Refer to the Installation and User's Guide for further information. */

#define SS_DBA_GRP "oracle"
#define SS_OPER_GRP "oraclei"

char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP};

Change: #define SS_DBA_GRP "oracle"
to: #define SS_DBA_GRP "dba"
mv config.o config.o.orig
make -f ins_rdbms.mk ioracle
===========================================================
2)Improper relinking during installation
bash-3.00$ pwd
/d1/oracle/product/102/bin
bash-3.00$ ./adapters
Installed Oracle Net transport protocols are:
IPC
BEQ
TCP/IP
SSL
RAW
SDP/IB

Installed Oracle Net naming methods are:

Local Naming (tnsnames.ora)
Oracle Directory Naming
Oracle Host Naming

Sunday, August 16, 2009

How to unlock orcladmin

You should use the "oidpasswd" utility to unlock the orcladmin account. Do not confuse this account with the default realm administrator "cn=orcladmin,cn=users,dc=xxxxx,dc=yyyyy".

1. Unlock the orcladmin
$ oidpasswd connect=your-database-sid unlock_su_acct=true
OID DB user password:
OID super user account unlocked successfully.
This unlocks the OID Super User account, cn=orcladmin ONLY. They are two separate accounts. After resetting the orcladmin super user account, you will still not be able to login to SSO using the orcladmin account until you perform the next step.

2. Launch the Oracle Directory Manager:
On unix: run the oidadmin command
On Windows: Start/Programs/Oracle AS10g/Integrated Management Tools/Oracle Directory Manager
Note: the ODM tool must be a 10g client.
login as orcladmin i.e superuser
Using the left menu tree, navigate to Password Policy Management. You will see TWO entries:
cn=PwdPolicyEntry
Password Policy for Realm

3. Edit each of these and change the Password Expiry Time (pwdmaxage) to an appropriate value
5184000 = 60 days (default)
7776000 = 90 days
10368000 = 120 days
15552000 = 180 days
31536000 = 1 year
999999999 = never expire

4. Launch the Oracle Directory Manager and navigate to the realm specific orcladmin account... Entry Management > your_realm > cn=Users where all the users a
re located. Click on the + next to cn=Users. The list is in alphabetical order.
Locate the cn=orcladmin entry. Find the userpassword attribute and reset the value.

5. Try the ldapbind again.
$ldapbind -p 13061 -D cn=orcladmin,cn=Users,dc=organization,dc=gov -w xxxxxxx7orcl
bind successful
$ldapbind -p 13061 -D cn=orcladmin -w xxxxxxx7ias
bind successful

6. Know after testing all binding is successful you can add an entry to OID.

Note#

Changing the Oracle Internet Directory Database Password
===============================================================
The Oracle Internet Directory uses a password when connecting to its own designated Oracle database.
The default for this password when you install Oracle Internet Directory is the same as that for the Oracle Fusion Middleware administrator. You can change this password by using oidpasswd.

The following example shows how to change the Oracle Internet Directory database password,
assuming the database in on the same machine.

oidpasswd connect=dbs1 change_oiddb_pwd=true
current password: oldpassword
new password: newpassword
confirm password: newpassword
password set.


Resetting the Superuser Password
==================================
If you forget the Oracle Internet Directory superuser (cn=orcladmin) password, you can
use the oidpasswd tool to reset it. You must provide the Oracle Internet Directory database password.
When you first install Oracle Internet Directory, the superuser password and Oracle Internet Directory database
password are the same. After installation, however, you can change the Oracle Internet Directory superuser password using ldapmodify.
If you forget the Oracle Internet Directory superuser password, you can reset it using the oidpasswd tool separately.

The following example shows how to reset the Oracle Internet Directory superuser password.
The oidpasswd tool prompts you for the Oracle Internet Directory database password.

Example:

oidpasswd connect=dbs1 reset_su_password=true
OID DB user password: oid_db_password
password: new_su_password
confirm password: new_su_password
OID superuser password reset successfully

Friday, August 14, 2009

Shared memory and semaphores are two important resources for an Oracle instance on Unix.

An instance cannot start if it is unable to allocate what it needs.
DEFINITIONS
Shared memory is exactly that - a memory region that can shared between different processes. Oracle uses shared memory for implementing the SGA, which needs to be visible to all database sessions.

Semaphores can be thought of as flags (hence their name, semaphores). They are either on or off. A process can turn on the flag or turn it off. If the flag is already on, processes who try to turn on the flag will sleep until the flag is off. Upon awakening, the process will reattempt to turn the flag on, possibly suceeding or possibly sleeping again. Such behaviour allows semaphores to be used in implementing a post-wait driver - a system where processes can wait for events (i.e. wait on turning on a semphore) and post events (i.e. turning of a semaphore). This mechanism is used by Oracle to maintain concurrency control over the SGA, since it is writeable by all processes attached.
ALLOCATION IN SIMPLE TERMS

Shared memory required by the Oracle Instance : On instance startup, the first things that the instance does is: -Read the "init.ora" -Start the background processes -Allocate the shared memory and semphores required The size of the SGA will be calculated from various "init.ora" parameters. This will be the amount of shared memory required. The SGA is broken into 4 sections - the fixed portion, which is constant in size, the variable portion, which varies in size depending on "init.ora" parameters, the redo block buffer, which has its size controlled by log_buffers, and the db block buffer, which has its size controlled by db_block_buffers. The size of the SGA is the sum of the sizes of the 4 portions. There is unfortunately no simple ormula for determining the size of the variable portion.
Generally, the shared pool dominates all other parts of the variable portion, so as a rule of thumb, one can estimate the size as the value of shared_pool_size.
The number of semphores required is much simpler to determine.
Oracle will need exactly as many semaphores as the value of the processes "init.ora" parameter.
SHARED MEMORY ALLOCATION
1. One-segment

2. Contigous multi-segment

3. Non-contigous multi-segment

When attempting to allocate and attach shared memory for the SGA, it will attempt each one, in the above order, until one succeeds or raises an ORA error. On other, non-fatal, errors, Oracle simply cleans up and tries again using the next memory model. The entire SGA must fit into shared memory, so the total amount of shared memory allocated under any model will be equal of the size of the SGA(SGASIZE).
1. One-segment:- The one-segment model is the simplest and first model tried. In this model, the SGA resides in only one shared memory segment. Oracle attempts to allocate and attach one shared memory segement of size equal to total size of the SGA. However, if the SGASIZE is larger than the configured SHMMAX, this will obviously fail. In this case, the SGA will need to be placed in multiple shared memory segments, and Oracle proceeds to the next memory model for the SGA.
With multiple segments there are two possibilities. The segments can be attached contiguously, so that it appears to be one large shared memory segment, or non-contiguously, with gaps between the segments.

2. Contigous multi-segment - In the contiguous segment model, Oracle simply divides the SGA into SGASIZE/SHMMAX (rounded down) segments of size SHMMAX plus another segment of size SGASIZE modulo SHMMAX

3. Non- contigous multi-segment : Once the number of segments and their sizes is determined, Oracle then allocates and attaches the segments one at a time; first the fixed and variable portion segment(s), then the redo block buffer segment(s), then the db block buffer segment(s). They will be attached non-contiguously,
At this point, we have either attached the entire SGA or returned an ORA error. The total size of segments attached is exactly SGASIZE; no space is wasted. Once Oracle has the shared memory attached, Oracle proceeds to allocating the semaphores it requires.
Recommended values of kernel parameters for Shared memory in
Oracle 8i
SHMMAX= max value of shared memory segment = .5 * size of
physical memory

SHMMIN= min size of shared memory segment=1

SHMMNI= max number of shared memory identifiers on system = 100

SHMSEG= max number of shared memory segments per process = 10
max Sga that can be created by the one segment model is SHMMAX*SHMSEG
You can display the current kernel parameters by doing a "sysdef -i"
SEMAPHORE ALLOCATION
Oracle just needs to allocate a number of semaphores equal to the processes parameter in "init.ora".
SEMMSL= # of semaphores in a semaphore set

SEMMNI= the maximum # of semaphores sets in the system

SEMMNS= the number of semaphores in the system.

SEMOPM= max number of operations per semop call = 100

SEMVMX = semaphore max value = 32767
When an Oracle instance is started, all required semaphores will be allocated. Semaphores are allocated in sets.
Since each oracle process* requires a semaphore, the number that is allocated is equal to the value of the init.ora parameter PROCESSES. The total # of semaphores required is the sum of all your instance's PROCESSES.
You can allocate all of your semaphores in one or more semaphore sets. If SEMMSL=PROCESSES, then only one semaphore set is required.
The maximum # of semaphores that can be allocated will be the lesser of (SEMMSL*SEMMNI) or SEMMNS.
If SEMMSL is not equal to PROCESSES, be sure that the total # of semaphores required (sum of PROCESSES) does not exceed the maximum (SEMMSL*SEMMNI, SEMMNS).
For example, if SEMMSL=25 and SEMMNI=10, total # of semaphores required (sum of PROCESSES) must not exceed 250 (10 semaphore sets * 25 semaphores/set).
Note: some Operating Systems have a maximum # of semaphore sets in the system.
If you have more than one instance and the values of PROCESSES are different, you may want to make SEMMSL equal to the lowest PROCESSES so that you don't allocate semaphores that will not be used. Otherwise, this could prevent you from being able to allocate all of your requirements.
For example:
Instance PROD has PROCESSES=100
Instance DEV has PROCESSES=50
If SEMMSL = 50, 3 semaphore sets will be allocated, 2 for PROD and 1 for DEV.
If SEMMSL = 100, 2 semaphore sets will be allocated, 1 for PROD
and 1 for DEV.In this case, 100 semaphores will be allocated for DEV when it will only use 50. These unused 50 semaphores cannot be allocated for any other databases.
To see what semaphores have been allocated, use the Unix command 'ipcs -b'.
For example:
Semaphores:
T ID KEY MODE OWNER GROUP NSEMS
s 0 0 --ra-r----- osupport dba 25
s 1 0 --ra-r----- osupport dba 25
s 18 0 --ra-r----- osupport dba 25
s 19 0 --ra-r----- osupport dba 25
s 4 0 --ra-r----- osupport dba 25
s 5 0 --ra-r----- osupport dba 25
NSEMS=the number of semaphores in each semaphores set.
Perform these steps for each instance that is up and running:
$ svrmgrl
SVRMGR>connect internal
SVRMGR>oradebug ipc
This will show the shared memory segment and semaphore that each instance has attached/in use.
Example output from oradebug ipc command:
-------------- Shared memory --------------
Seg Id Address Size
10250 c1eaf000 4591616
Total: # of segments = 1, size = 4591616
-------------- Semaphores ----------------
Total number of semaphores = 50
Number of semaphores per set = 50
Number of semaphore sets = 1
Semaphore identifiers:
188434
The Seg Id shows 10250 for the shared memory which is attacehed to the RUNNING instance. DO NOT REMOVE THAT ONE.
The Semaphore identifiers shows 188434 for the semaphore which is attacehed to the RUNNING instance. DO NOT REMOVE THAT ONE.
Once you have noted ALL of the identifiers for ALL of the instances which are up and running, compare these id numbers to those in the "ipcs -b" listing.
The entry that does not have a running instance to match is the orphaned entry. THAT ONE SHOULD BE REMOVED.
The command used to remove these entries is: ipcrm
NOTE: The option differs for shared memory and semaphores.
ipcrm -m <== Use for the Shared Memory entry

ipcrm -s <== Use for the Semaphore entry


Refrence Oracle Metalink 15566.1

How to set shmall

shmall is the total amount of shared memory, in pages, that the system can use at one time.
Set shmall equal to the sum of all the SGAs on the system, divided by the page size.
The page size can be determined using the following command:
$ getconf PAGE_SIZE
4096
For example, if the sum of all the SGAs on the system is 16Gb and the result of
$ getconf PAGE_SIZE is 4096 (4Kb) then set shmall to 4194304 pages
As the root user set the shmall to 4194304 in the /etc/sysctl.conf file:
kernel.shmall = 4194304
then run the following command:
# sysctl -p
# cat /proc/sys/kernel/shmall
4194304
NOTE:
The above command loads the new value and a reboot is not necessary
Switch back to being the oracle user and retry the startup command.

Thursday, August 13, 2009

Configuring HugePages

Hugepages is a mechanism that allows the Linux kernel to utilise the multiple page size capabilities of modern hardware architectures. Linux uses pages as the basic unit of memory – physical memory is partitioned and accessed using the basic page unit. The default page size is 4096 Bytes in the x86 architecture.
Hugepages allows large amounts of memory to be utilised with a reduced overhead. Linux uses a mechanism in the CPU architecture called “Transaction Lookaside Buffers” (TLB). These buffers contain mappings of virtual memory to actual physical memory addresses. The TLB is a limited hardware resource, so utilising a huge amount of physical memory with the default page size consumes the TLB and adds processing overhead.

The Linux kernel is able to set aside a portion of physical memory to be able be addressed using a larger page size. Since the page size is higher, there will be less overhead managing the pages with the TLB.
In the Linux 2.6 series of kernels, hugepages is enabled using the CONFIG_HUGETLB_PAGE feature when the kernel is built. All kernels supplied by Red Hat for the Red Hat Enterprise Linux 4 release have the feature enabled.
Systems with large amount of memory can be configured to utilise the memory more efficiently by setting aside a portion dedicated for hugepages. The actual size of the page is dependent on the system architecture. A typical x86 system will have a Huge Page Size of 2048 kBytes.

“HugePages_Total” and “HugePages_Free” provide information about the amount of hugepages allocated (removed from “normal” memory) and the amount free (available for use).
HugePages is memory managed in 2 Mb blocks (this is huge compared to 4 Kb). This memory is also locked in RAM and cannot be swapped out. It is not even considered for swapping.
Programs that would like to use this memory need to have additional flags. Oracle attempts to use hugepages memory for the SGA if available. There are a number of permissions associated with using hugepages as well. See next sections for details.

The huge page size may be found by looking at the /proc/meminfo :
# cat /proc/meminfo |grep Hugepagesize
Hugepagesize: 2048 kB

Follow the following steps to enable Oracle to start using Hugepage.
=====================================================================
1.Hugepage counting formula
(SGA_SIZE/2M ) + 100
So for 10G SGA hugepage should be set to ,
((10*1024)M / 2M ) + 100 = 5220
You can find SGA size from show sga command on sqlplus prompt.

2.Please put following kernel parameter into /etc/sysctl.conf file.
vm.nr_hugepages = 5220

3.Run the following command.
#sysctl -p

4. Modify /etc/security/limits.conf file to have following entry.
oracle soft memlock 20086560
oracle hard memlock 20086560
Then Reboot the machine.

5.Check the Hugepage Total and Hugepage Free using following command.
#cat /proc/meminfo | grep -i huge
This should return like following.
HugePages_Total: 5220
HugePages_Free: 5220
HugePages_Rsvd: 00
Hugepagesize: 2048 kB
Also check the memlock setting using ulimit -a command.

6.Start the Oracle DB and check whether Hugepage is getting allocated or not by using following command.
#cat /proc/meminfo | grep -i huge
Issue cat /proc/meminfo to see how many HugePages are available. If the number of available is much less then the number you configured, reboot the system to defragment the RAM. Linux needs to find continuous 2 Mb pages.

Friday, August 7, 2009

Forms Server in R12 Oracle Applications

Forms Server in R12 Oracle Applications can be configured in two different
modes: Servlet and Socket
Servlet mode: -------------
Forms Server is started in Servlet mode using the script
<>/adformsctl.sh
- All the variables required by Forms Server in Servlet mode are defined in
<>/ora/10.1.2/forms/server/default.env
Forms Server when started in Servlet mode reads the name-value pairs
defined in the file <>/ora/10.1.2/forms/server/default.env to
determine the values for different variables .
Socket mode: ------------
- Forms Server is started in Socket mode using the script
<>/adformsrvctl.sh
- All the variables required by Forms Server in Socket mode are set in
<>/ora/10.1.2/forms/server/socket.env
- Forms Server when started in Socket mode reads the values for different
variables from the environment
- All the variables are set in the environment by the script
<>/adformsctl.sh by sourcing the file
<>/ora/10.1.2/forms/server/socket.env before starting the Forms
Server.

Monday, August 3, 2009

How to Clear Stuck NFS Locks on NetApp Filer(s)

For Linux:

1) First shutdown all oracle database instances and kill off any stray background oracle processes, check for stray processes using:
$ ps -ef grep ora to get process id's (pid's) of remaining Oracle processes
$ kill -9 for each remaining Oracle process.

2) Unmount all NFS partitions. e.g:
A)# umount /u07.

If you have problems unmounting because of open files, use /usr/sbin/lsof to assist you in determining what files are still open on what mount points.
B) Shutdown nfs statd and lockd.
# /sbin/service nfs stop# /sbin/service nfslock stop

3) Clear NetApp filer locks:
Execute the following from the NetApp filer command line:
§ priv set advanced§ sm_mon -l.
In many cases specifying the host name does not clear all the affecting locks, so the recommendation from NetApp is to NOT specify a hostname.

4) Restart NFS services & remount NFS partitions
# /sbin/service nfs start
# /sbin/service nfslock start
# mount -a
If it's not possible to unmount all NFS partitions, schedule a reboot to clear the stale NFS lockson the Linux host.

Example:-
[root@abcd06~]# rsh abcd09 "priv set advanced;lock status -h" grep abcdtest

Warning: These advanced commands are potentially dangerous; use them only when directed to do so by Network Appliance personnel.
===============
NLM host abcdtest.abc.com
===============
[root@abcd06~]# rsh abcd09"priv set advanced ;sm_mon -l abcdtest"

Warning: These advanced commands are potentially dangerous; use them only when directed to do so by Network Appliance personnel.