If you are on a Windows Server you need to know about the Windows Services and the oradim utility.
On all versions of Windows the Oracle Database (and the Application Server) are started as Windows Services. This allows them to start in the background, normally owned by SYSTEM.
In an earlier Tip I discussed starting and stopping the Application Server 10g on Windows using a script to start and stop the component's service. The AS10g (and 9iAS) components can be started from the command line and will start the windows service however, the database (both the back end and the Metadata Repository) can not start without the database service running.
The Oracle Database must have a running service.
The Oracle database must attach itself to a running process. It is the Win Service that provides this process. Most DBAs think that the service is the database but that is not true. The service can start/stop the database but it can also be started without starting the database.
Most Problem with the Win Service for the Database involve the service starting but the database not starting.
If the Win service is set to automatically start when the server boots but the database does not start, you may have a improper registry setting or you may have a bad service.
1. Check Task Manager for the ORACLE.EXE process. If it is present, then the service started.
2. Check the Alert Log for the database. If the problem is not with the database, there will be no indication in the log that the database even tried to start.
3. Check the oradim.log in the $ORACLE_HOME/database directory for errors. Check the date on the log file as versions before 9i did not date/time stamp the entries.
If there are no errors in the logs then try and start the database.
C:> sqlplus "/ as sysdba"
connected to an idle instance
SQL> starup
If the database starts great, the problem is in the service.
To check the Win service:
Open the registry with regedit. Always back up the registry before making changes. Navigate to the key:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\oracle_home_name.
There will be a key called:
ORA_SID_AUTOSTART (SID is your database SID)
This key should be set to TRUE. If not the server starts but does not start the database. There is also an ORA_SID_SHUTDOWN which you want to be TRUE so that if the server is shut down the service will shutdown the database.
If you want to manually start the database set ORA_SID_AUTOSTART to FALSE. The service will start but not the database.
Test the service.
If the ORA_SID_AUTOSTART setting was the problem, change it to TRUE and then test the service by stopping and then restarting the service to see it the database automatically starts. If it does, then that fixed your problem......or maybe is didn't. Reboot the server to verify that the database will start automatically. Sometimes the service will work, only to fail again after a reboot. If the service fail after rebooting you need to recreate it. This is where the oradim utility comes in.
Deleting a Service
First delete or rename the oradim.log file.
Next delete the current service.
C:>oradim -delete -sid SID
SID is of course you database SID. This may take a while so check the services to insure that the OracleServiceSID is removed before proceeding.
Creating a new Service.
Again we use oradim to recreate the service. This entire command is on one line.
c:> oradim -new -sid SID -intpwd password -startmode AUTO -pfile c:\oracle\admin\SID\pfile\initSID.ora
This command does a lot and will take some time to complete (if startmode is set to AUTO it will start the database). It recreate the database password and sets the internal password to password. NOTE: oradim changes the internal password.
The startmode determines if the service starts the database when it starts. If set to AUTO then the key ORA_SID_AUTOSTART is set to TRUE. If startmode is MANUAL then the key is set to FALSE.
Check the oradim.log for errors. Finally, verify the service works as needed by starting and stopping it. Then test with a reboot. If the service fails try recreating it again.
Scripting the Database Start in Windows
The dbstart and dbstop shell scripts do not exist on Windows platforms. Consequently Oracle database startup and shutdown is implemented completely differently. The oradim utility is used on the Windows platform to perform these tasks.
C:\oracle9i\bin\oradim -startup -sid ORCL92 –usrpwd manager
-starttype SRVC,INST -pfile
C:\oracle9i\admin\ORCL92\pfile\init.ora
• startup – Indicates that the specified instance should be started.
• sid – The SID of the database to start.
• usrpwd – The password for the database user.
• starttype – Specifies whether to start the instance, the service, or both (SRVC, INST).
The following command can be used to shutdown the instance with oradim:
C:\oracle9i\bin\oradim -shutdown -sid ORCL92 -shutttype SRVC,INST
–shutmode A
Notice that no password is needed to perform this task.
If you can't get the service to function properly you are left with scripting the starting of the database. Recreate the service with the -startmode set to MANUAL. Then create a batch file as follows:
REM Wait for the server to start.
sleep 60
REM Start the database
%ORACLE_HOME%\bin\sqlplus -s "/ as sysdba" @startup.sql
exit
The startup.sql file
-- start the database
startup
exit
-Now schedule the batch file in the Windows Scheduler to run at startup.
-If this is part of you AS10g, you can implement the startup in the script used to start the application server components.
Thursday, January 7, 2010
Tuesday, December 29, 2009
Configuring ASM on Windows environment
1) With asmtool
Follow below steps and create a ASM diskgroup on your local m/c
1) Creating a disks with asmtool
D:\>mkdir asmdisks
D:\>cd asmdisks
D:\asmdisks>asmtool -create D:\asmdisks\disk1 1024
D:\asmdisks>asmtool -create D:\asmdisks\disk2 1024
D:\asmdisks>asmtool -create D:\asmdisks\disk3 1024
Note: - size should be in MB’s
Now you have 3 disks of 1024mb each which can be used to create a ASM disk group.
2) Create ASM instance: -
a) Configure Cluster Synchronization Service: -
C:\oracle\product\10.2.0\db_1\BIN>localconfig add
Step 1: stopping local CSS stack
Step 2: deleting OCR repository
Step 3: creating new OCR repository
successfully accumulated necessary OCR keys.
Creating OCR keys for user 'hostname', privgrp ' ' . .
Operation successful.
Step 4: creating new CSS service
successfully created local CSS service
successfully reset location of CSS setup
b) Create init file: -
Open notepad edit the following parameters and save file as "C:\oracle\product\ 10.2.0\db_ 1\database\ init+ASM. ora"
INSTANCE_TYPE= ASM
DB_UNIQUE_NAME= +ASM
LARGE_POOL_SIZE= 8M
ASM_DISKSTRING= 'D:\asmdisks\ *'
_ASM_ALLOW_ONLY_ RAW_DISKS= FALSE
c) Create service and password file
oradim will create an ASM instance and start it automatically.
D:\> orapwd file=C:\oracle\ product\10. 2.0\db_1\ database\ PWD+ASM.ora password=asm
D:\> oradim -NEW -ASMSID +ASM -STARTMODE auto
3) Starting ASM instance: -
a) Change PFILE to SPFILE, Add ASM Diskgroup parameter and your all set to go and use ASM.
SQL> create spfile from pfile;
SQL> startup nomount;
Create asm disk group: -
SQL> select path, mount_status from v$asm_disk;
PATH MOUNT_STATUS
----------------------- -------------------
D:\ASMDISKS\ DISK1 CLOSED
D:\ASMDISKS\ DISK3 CLOSED
D:\ASMDISKS\ DISK2 CLOSED
SQL> create diskgroup data external redundancy disk
2 'D:\ASMDISKS\DISK1',
3 'D:\ASMDISKS\DISK2',
4 'D:\ASMDISKS\DISK3'
5 /
Diskgroup created.
SQL> alter system set asm_diskgroups= data scope=spfile;
SQL> shutdown immediate
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1247420 bytes
Variable Size 57472836 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
Now you can go ahead and use your DBCA and create a database and on step 6 of 13, you can use Automatic Storage management as your Filesystem.
Follow below steps and create a ASM diskgroup on your local m/c
1) Creating a disks with asmtool
D:\>mkdir asmdisks
D:\>cd asmdisks
D:\asmdisks>asmtool -create D:\asmdisks\disk1 1024
D:\asmdisks>asmtool -create D:\asmdisks\disk2 1024
D:\asmdisks>asmtool -create D:\asmdisks\disk3 1024
Note: - size should be in MB’s
Now you have 3 disks of 1024mb each which can be used to create a ASM disk group.
2) Create ASM instance: -
a) Configure Cluster Synchronization Service: -
C:\oracle\product\10.2.0\db_1\BIN>localconfig add
Step 1: stopping local CSS stack
Step 2: deleting OCR repository
Step 3: creating new OCR repository
successfully accumulated necessary OCR keys.
Creating OCR keys for user 'hostname', privgrp ' ' . .
Operation successful.
Step 4: creating new CSS service
successfully created local CSS service
successfully reset location of CSS setup
b) Create init file: -
Open notepad edit the following parameters and save file as "C:\oracle\product\ 10.2.0\db_ 1\database\ init+ASM. ora"
INSTANCE_TYPE= ASM
DB_UNIQUE_NAME= +ASM
LARGE_POOL_SIZE= 8M
ASM_DISKSTRING= 'D:\asmdisks\ *'
_ASM_ALLOW_ONLY_ RAW_DISKS= FALSE
c) Create service and password file
oradim will create an ASM instance and start it automatically.
D:\> orapwd file=C:\oracle\ product\10. 2.0\db_1\ database\ PWD+ASM.ora password=asm
D:\> oradim -NEW -ASMSID +ASM -STARTMODE auto
3) Starting ASM instance: -
a) Change PFILE to SPFILE, Add ASM Diskgroup parameter and your all set to go and use ASM.
SQL> create spfile from pfile;
SQL> startup nomount;
Create asm disk group: -
SQL> select path, mount_status from v$asm_disk;
PATH MOUNT_STATUS
----------------------- -------------------
D:\ASMDISKS\ DISK1 CLOSED
D:\ASMDISKS\ DISK3 CLOSED
D:\ASMDISKS\ DISK2 CLOSED
SQL> create diskgroup data external redundancy disk
2 'D:\ASMDISKS\DISK1',
3 'D:\ASMDISKS\DISK2',
4 'D:\ASMDISKS\DISK3'
5 /
Diskgroup created.
SQL> alter system set asm_diskgroups= data scope=spfile;
SQL> shutdown immediate
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1247420 bytes
Variable Size 57472836 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
Now you can go ahead and use your DBCA and create a database and on step 6 of 13, you can use Automatic Storage management as your Filesystem.
Monday, December 21, 2009
SYSRESV Utility
This utility was the result of enhancement request 566223 [BUG: 566223]:
"Currently, many Oracle applications determine whether a particular instance is up by checking for the presence of the sgadef file. We should provide a separate utility for this purpose instead, based on the contents of the SGA."
The sysresv utility included with Oracle 8.1.5 and above provides instance status (and OS resources used) for specified ORACLE_SIDs. This utility is especially useful when multiple instances are running. OS resources can be removed using this utility if the specified instance is detected to be dead.
This utility may be useful when an instance has crashed or was aborted and memory and semaphores related to this instance were not cleaned up automatically. This utility is also helpful in determining which instance is running. The sysresv utility, located in $ORACLE_HOME/bin, can be used from locations other than $ORACLE_HOME/bin.
Point your environment to the instance of interest before using sysresv.
NOTE: (9i 64-bit):
Must set up as follows to get sysresv to work.
Oracle 9.X.X (64Bit) on Solaris (64Bit) OS
- Set LD_LIBRARY_PATH=$ORACLE_HOME/lib32
- Set LD_LIBRARY_PATH_64=$ORACLE_HOME/lib
Usage:
sysresv:
usage :
sysresv [-if] [-d (on/off)] [-l sid1 (sid2) ...]
-i : Prompt before removing ipc resources for each sid
-f : Remove ipc resources silently, over rides -i option
-d (on/off) : List ipc resources for each sid if on
-l sid1 (sid2) .. : apply sysresv to each sid
Default: sysresv -d on -l $ORACLE_SID
Note: ipc resources are attempted to be deleted for a sid only if there is no currently running instance with that sid.
Examples:
Instance is not running:
/u02/app/oracle/product/8.1.7 $ sysresv
IPC Resources for ORACLE_SID “R817”:
Shared Memory
ID KEY
No shared memory segments used
Semaphores:
ID KEY
No semaphore resources used
Oracle Instance not alive for sid "R817"
Instance is running:
/u03/app/oracle/product/8.1.6 $ sysresv
IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16437 0xe4efa8dc
Semaphores:
ID KEY
12320802 0x09d48346
Oracle Instance alive for sid "X816"
Attempting to remove memory and semaphores using sysresv when Oracle detects an instance is running:
/u03/app/oracle/product/8.1.6 $ sysresv -f
IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16437 0xe4efa8dc
Semaphores:
ID KEY
12320802 0x09d48346
Oracle Instance alive for sid "X816"
SYSRESV-005: Warning
Instance maybe alive - aborting remove for sid "X816"
Removing IPC resources:
[Sysresv shows memory and semaphores exist but Oracle determines the instance is not alive. Cleanup is needed.]
/u03/app/oracle/product/8.1.6 $ sysresv
IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16837 0xe4efa8dc
Semaphores:
ID KEY
12714018 0x09d48346
Oracle Instance not alive for sid "X816"
Removing IPC resources using sysresv:
/u03/app/oracle/product/8.1.6 $ sysresv -i
IPC Resources for ORACLE_SID "X816" :
Shared Memory
ID KEY
No shared memory segments used
Semaphores:
ID KEY
No semaphore resources used
Oracle Instance not alive for sid "X816"
Remove ipc resources for sid "X816" (y/n)?y
Done removing ipc resources for sid "X816"
/u03/app/oracle/product/8.1.6
Verify the resources were removed:
/u03/app/oracle/product/8.1.6 $ sysresv
IPC Resources for ORACLE_SID "X816" :
Shared Memory
ID KEY
No shared memory segments used
Semaphores:
ID KEY
No semaphore resources used
Oracle Instance not alive for sid "X816"
If you need to remove memory segments, and Oracle detects the instance is alive through sysresv:
$ ipcrm -m (memid)
Where (memid) is the memory id shown in the sysresv output.
Example:
$ ipcrm -m 16437
If you need to remove semaphores, and Oracle detects the instance is alive through sysresv:
$ ipcrm -s (semid)
where (semid) is the semaphore id shown in the sysresv output.
Example:
$ ipcrm -s 12320802
115235.1
Resolving ORA-7279 or ORA-27146 errors when starting instance
Problem Description
-------------------
When attempting to start an instance, you receive the following error:
ORA-7279: spcre: semget error, unable to get first semaphore set
This error may possibly be accompanied by one or more of the following
additional errors:
ORA-600: internal error code, arguments [SKGMBUSY]
SVR4 error: 28: no space left on device
If you are using version 8.1.5 or 8.1.6, you receive the following error instead of the ora-7279 when attempting to start an instance:
ORA-27146: post/wait initialization failed
With 8.1.7, instance startup fails with ora-3113.
These errors happen whenever attempting to start an instance, which includes, but is not limited to, creating a new database during an install, creating a new database with an existing install, starting an existing database which had the initSID.ora parameter PROCESSES changed, or starting an existing database which was either shutdown incorrectly or crashed.
Solution Description
The problem is that there are not enough semaphores to start the instance. This can be resolved based on one of the two scenarios below:
Scenario 1
If no new instances have been created and you are trying to start an existing database which was shutdown incorrectly or crashed, the semaphores from the crashed instance may still be allocated and will need to be removed.
Step 1: -
Before removing semaphores, you should be certain that there are no running instances using them. First check for running instances using the following command:
$ ps -ef | grep -v grep | grep pmon
If there are no pmon processes running, then there should be no semaphores owned by the oracle user, and any semaphores owned by the oracle user can safely be removed.
See steps 3 and 4 for the commands to list and remove semaphores.
Step 2: -
If you have multiple instances running, you will need to either shut them down or determine which semaphores are being used by each instance. It is recommended that you shut down all of the instances, but if this is not possible, then follow the instructions below.
A) If the running instances are version 8.1.x or higher, set your environment to that of the running instance, then run the following command:
% $ORACLE_HOME/bin/sysresv
This will show you the semaphore ids being used by this instance. Make a note of them and repeat the sysresv command for each running instance.
B) If you are not running version 8.1.x or higher, use the following commands to get a listing of semaphores:
$ svrmgrl
svrmgr) connect internal
svrmgr) oradebug ipc
Repeat these commands for each running instance making note of the "Semaphore identifiers" for each.
Step 3)
Now get a list of all of the allocated semaphores on the system using the following command:
% ipcs -sb | grep -v grep | grep (oracle)
where (oracle) is the name of the oracle user.
Compare the output of the ipcs command with the notes you made from the sysresv command or oradebug ipc command , and remove any semaphores that do not belong to a running instance.
Step 4)
You can remove semaphores using the following command:
% ipcrm -s (semid)
where (semid) is the semaphore id shown in the second column of the ipcs output titled ID.
Step 5)
Now try to start your instance again.
Scenario 2
----------
You are trying to start a new instance, or an existing instance that had the initSID.ora parameter PROCESSES changed. You will need to raise the kernel parameter SEMMNS.
Set the kernel parameter SEMMNS to double the sum of all of the initSID.ora PROCESSES parameters on the system.
For example, if you have 5 instances with the initSID.ora PROCESSES parameter set to 25, 50, 100, 200, and 250, then set the kernel parameter SEMMNS equal to 1250.
((25 + 50 + 100 + 200 + 250) * 2) = 1250
After making changes to the kernel parameter SEMMNS, you will be required to reboot the system. Depending on your operating system, you may also be required to rebuild the kernel. For more information on changing kernel parameters, please consult your OS documentation and/or your OS vendor.
"Currently, many Oracle applications determine whether a particular instance is up by checking for the presence of the sgadef file. We should provide a separate utility for this purpose instead, based on the contents of the SGA."
The sysresv utility included with Oracle 8.1.5 and above provides instance status (and OS resources used) for specified ORACLE_SIDs. This utility is especially useful when multiple instances are running. OS resources can be removed using this utility if the specified instance is detected to be dead.
This utility may be useful when an instance has crashed or was aborted and memory and semaphores related to this instance were not cleaned up automatically. This utility is also helpful in determining which instance is running. The sysresv utility, located in $ORACLE_HOME/bin, can be used from locations other than $ORACLE_HOME/bin.
Point your environment to the instance of interest before using sysresv.
NOTE: (9i 64-bit):
Must set up as follows to get sysresv to work.
Oracle 9.X.X (64Bit) on Solaris (64Bit) OS
- Set LD_LIBRARY_PATH=$ORACLE_HOME/lib32
- Set LD_LIBRARY_PATH_64=$ORACLE_HOME/lib
Usage:
sysresv:
usage :
sysresv [-if] [-d (on/off)] [-l sid1 (sid2) ...]
-i : Prompt before removing ipc resources for each sid
-f : Remove ipc resources silently, over rides -i option
-d (on/off) : List ipc resources for each sid if on
-l sid1 (sid2) .. : apply sysresv to each sid
Default: sysresv -d on -l $ORACLE_SID
Note: ipc resources are attempted to be deleted for a sid only if there is no currently running instance with that sid.
Examples:
Instance is not running:
/u02/app/oracle/product/8.1.7 $ sysresv
IPC Resources for ORACLE_SID “R817”:
Shared Memory
ID KEY
No shared memory segments used
Semaphores:
ID KEY
No semaphore resources used
Oracle Instance not alive for sid "R817"
Instance is running:
/u03/app/oracle/product/8.1.6 $ sysresv
IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16437 0xe4efa8dc
Semaphores:
ID KEY
12320802 0x09d48346
Oracle Instance alive for sid "X816"
Attempting to remove memory and semaphores using sysresv when Oracle detects an instance is running:
/u03/app/oracle/product/8.1.6 $ sysresv -f
IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16437 0xe4efa8dc
Semaphores:
ID KEY
12320802 0x09d48346
Oracle Instance alive for sid "X816"
SYSRESV-005: Warning
Instance maybe alive - aborting remove for sid "X816"
Removing IPC resources:
[Sysresv shows memory and semaphores exist but Oracle determines the instance is not alive. Cleanup is needed.]
/u03/app/oracle/product/8.1.6 $ sysresv
IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16837 0xe4efa8dc
Semaphores:
ID KEY
12714018 0x09d48346
Oracle Instance not alive for sid "X816"
Removing IPC resources using sysresv:
/u03/app/oracle/product/8.1.6 $ sysresv -i
IPC Resources for ORACLE_SID "X816" :
Shared Memory
ID KEY
No shared memory segments used
Semaphores:
ID KEY
No semaphore resources used
Oracle Instance not alive for sid "X816"
Remove ipc resources for sid "X816" (y/n)?y
Done removing ipc resources for sid "X816"
/u03/app/oracle/product/8.1.6
Verify the resources were removed:
/u03/app/oracle/product/8.1.6 $ sysresv
IPC Resources for ORACLE_SID "X816" :
Shared Memory
ID KEY
No shared memory segments used
Semaphores:
ID KEY
No semaphore resources used
Oracle Instance not alive for sid "X816"
If you need to remove memory segments, and Oracle detects the instance is alive through sysresv:
$ ipcrm -m (memid)
Where (memid) is the memory id shown in the sysresv output.
Example:
$ ipcrm -m 16437
If you need to remove semaphores, and Oracle detects the instance is alive through sysresv:
$ ipcrm -s (semid)
where (semid) is the semaphore id shown in the sysresv output.
Example:
$ ipcrm -s 12320802
115235.1
Resolving ORA-7279 or ORA-27146 errors when starting instance
Problem Description
-------------------
When attempting to start an instance, you receive the following error:
ORA-7279: spcre: semget error, unable to get first semaphore set
This error may possibly be accompanied by one or more of the following
additional errors:
ORA-600: internal error code, arguments [SKGMBUSY]
SVR4 error: 28: no space left on device
If you are using version 8.1.5 or 8.1.6, you receive the following error instead of the ora-7279 when attempting to start an instance:
ORA-27146: post/wait initialization failed
With 8.1.7, instance startup fails with ora-3113.
These errors happen whenever attempting to start an instance, which includes, but is not limited to, creating a new database during an install, creating a new database with an existing install, starting an existing database which had the initSID.ora parameter PROCESSES changed, or starting an existing database which was either shutdown incorrectly or crashed.
Solution Description
The problem is that there are not enough semaphores to start the instance. This can be resolved based on one of the two scenarios below:
Scenario 1
If no new instances have been created and you are trying to start an existing database which was shutdown incorrectly or crashed, the semaphores from the crashed instance may still be allocated and will need to be removed.
Step 1: -
Before removing semaphores, you should be certain that there are no running instances using them. First check for running instances using the following command:
$ ps -ef | grep -v grep | grep pmon
If there are no pmon processes running, then there should be no semaphores owned by the oracle user, and any semaphores owned by the oracle user can safely be removed.
See steps 3 and 4 for the commands to list and remove semaphores.
Step 2: -
If you have multiple instances running, you will need to either shut them down or determine which semaphores are being used by each instance. It is recommended that you shut down all of the instances, but if this is not possible, then follow the instructions below.
A) If the running instances are version 8.1.x or higher, set your environment to that of the running instance, then run the following command:
% $ORACLE_HOME/bin/sysresv
This will show you the semaphore ids being used by this instance. Make a note of them and repeat the sysresv command for each running instance.
B) If you are not running version 8.1.x or higher, use the following commands to get a listing of semaphores:
$ svrmgrl
svrmgr) connect internal
svrmgr) oradebug ipc
Repeat these commands for each running instance making note of the "Semaphore identifiers" for each.
Step 3)
Now get a list of all of the allocated semaphores on the system using the following command:
% ipcs -sb | grep -v grep | grep (oracle)
where (oracle) is the name of the oracle user.
Compare the output of the ipcs command with the notes you made from the sysresv command or oradebug ipc command , and remove any semaphores that do not belong to a running instance.
Step 4)
You can remove semaphores using the following command:
% ipcrm -s (semid)
where (semid) is the semaphore id shown in the second column of the ipcs output titled ID.
Step 5)
Now try to start your instance again.
Scenario 2
----------
You are trying to start a new instance, or an existing instance that had the initSID.ora parameter PROCESSES changed. You will need to raise the kernel parameter SEMMNS.
Set the kernel parameter SEMMNS to double the sum of all of the initSID.ora PROCESSES parameters on the system.
For example, if you have 5 instances with the initSID.ora PROCESSES parameter set to 25, 50, 100, 200, and 250, then set the kernel parameter SEMMNS equal to 1250.
((25 + 50 + 100 + 200 + 250) * 2) = 1250
After making changes to the kernel parameter SEMMNS, you will be required to reboot the system. Depending on your operating system, you may also be required to rebuild the kernel. For more information on changing kernel parameters, please consult your OS documentation and/or your OS vendor.
Tuesday, November 17, 2009
Oracle Merge Statements
Syntax: -
MERGE (hint) INTO (table_name)
USING (table_view_or_query)
ON ((condition))
WHEN MATCHED THEN (update_clause)
DELETE (where_clause)
WHEN NOT MATCHED THEN (insert_clause)
[LOG ERRORS (log_errors_clause) (reject limit (integer unlimited)];
Ex: -
CREATE TABLE employee (employee_id NUMBER(5),first_name VARCHAR2(20),last_name VARCHAR2(20),dept_no NUMBER(2),salary NUMBER(10));
INSERT INTO employee VALUES (1, 'Dan', 'Morgan', 10, 100000);INSERT INTO employee VALUES (2, 'Helen', 'Lofstrom', 20, 100000);INSERT INTO employee VALUES (3, 'Akiko', 'Toyota', 20, 50000);INSERT INTO employee VALUES (4, 'Jackie', 'Stough', 20, 40000);INSERT INTO employee VALUES (5, 'Richard', 'Foote', 20, 70000);INSERT INTO employee VALUES (6, 'Joe', 'Johnson', 20, 30000);INSERT INTO employee VALUES (7, 'Clark', 'Urling', 20, 90000);
CREATE TABLE bonuses (employee_id NUMBER, bonus NUMBER DEFAULT 100);
INSERT INTO bonuses (employee_id) VALUES (1);INSERT INTO bonuses (employee_id) VALUES (2);INSERT INTO bonuses (employee_id) VALUES (4);INSERT INTO bonuses (employee_id) VALUES (6);INSERT INTO bonuses (employee_id) VALUES (7);COMMIT;
SELECT * FROM employee;
SELECT * FROM bonuses;
MERGE INTO bonuses bUSING ( SELECT employee_id, salary, dept_no FROM employee WHERE dept_no =20) eON (b.employee_id = e.employee_id)WHEN MATCHED THEN UPDATE SET b.bonus = e.salary * 0.1 DELETE WHERE (e.salary <> 40000);
SELECT * FROM bonuses;
MERGE (hint) INTO (table_name)
USING (table_view_or_query)
ON ((condition))
WHEN MATCHED THEN (update_clause)
DELETE (where_clause)
WHEN NOT MATCHED THEN (insert_clause)
[LOG ERRORS (log_errors_clause) (reject limit (integer unlimited)];
Ex: -
CREATE TABLE employee (employee_id NUMBER(5),first_name VARCHAR2(20),last_name VARCHAR2(20),dept_no NUMBER(2),salary NUMBER(10));
INSERT INTO employee VALUES (1, 'Dan', 'Morgan', 10, 100000);INSERT INTO employee VALUES (2, 'Helen', 'Lofstrom', 20, 100000);INSERT INTO employee VALUES (3, 'Akiko', 'Toyota', 20, 50000);INSERT INTO employee VALUES (4, 'Jackie', 'Stough', 20, 40000);INSERT INTO employee VALUES (5, 'Richard', 'Foote', 20, 70000);INSERT INTO employee VALUES (6, 'Joe', 'Johnson', 20, 30000);INSERT INTO employee VALUES (7, 'Clark', 'Urling', 20, 90000);
CREATE TABLE bonuses (employee_id NUMBER, bonus NUMBER DEFAULT 100);
INSERT INTO bonuses (employee_id) VALUES (1);INSERT INTO bonuses (employee_id) VALUES (2);INSERT INTO bonuses (employee_id) VALUES (4);INSERT INTO bonuses (employee_id) VALUES (6);INSERT INTO bonuses (employee_id) VALUES (7);COMMIT;
SELECT * FROM employee;
SELECT * FROM bonuses;
MERGE INTO bonuses bUSING ( SELECT employee_id, salary, dept_no FROM employee WHERE dept_no =20) eON (b.employee_id = e.employee_id)WHEN MATCHED THEN UPDATE SET b.bonus = e.salary * 0.1 DELETE WHERE (e.salary <> 40000);
SELECT * FROM bonuses;
Tuesday, November 10, 2009
ORA-00600 Metalink Notes
ORA - 600 -- Look at these Metalink notes for Help
ORA-600 Errors 1 to 3000
Note 138300.1 "ORA-600 [105]"
Note 263295.1 "ORA-600 [106]"
Note 28104.1 "ORA-600 [504]"
Note 138871.1 "ORA-600 [510]"
Note 138888.1 "ORA-600 [525]"
Note 138939.1 "ORA-600 [711]"
Note 39308.1 "ORA-600 [723]"
Note 31056.1 "ORA-600 [729]"
Note 131490.1 "ORA-600 [733]"
Note 217860.1 "ORA-600 [1013]"
Note 138123.1 "ORA-600 [1100]"
Note 41767.1 "ORA-600 [1113]"
Note 40514.1 "ORA-600 [1114]"
Note 137262.1 "ORA-600 [1115]"
Note 66387.1 "ORA-600 [1158]"
Note 138354.1 "ORA-600 [1236]"
Note 28045.1 "ORA-600 [2103]"
Note 28929.1 "ORA-600 [2662]"
Note 31057.1 "ORA-600 [2845]"
Note 138733.1 "ORA-600 [2865]"
ORA-600 Errors 3001 to 6000
Note 30866.1 "ORA-600 [3020]"
Note 93665.1 "ORA-600 [3668]"
Note 47456.1 "ORA-600 [4000]"
Note 96642.1 "ORA-600 [4036]"
Note 43914.1 "ORA-600 [4137]"
Note 28226.1 "ORA-600 [4146]"
Note 39282.1 "ORA-600 [4193]"
Note 39283.1 "ORA-600 [4194]"
Note 138822.1 "ORA-600 [4400]"
Note 29702.1 "ORA-600 [4414]"
Note 138836.1 "ORA-600 [4454]"
Note 39553.1 "ORA-600 [4511]"
Note 73455.1 "ORA-600 [4512]"
Note 27955.1 "ORA-600 [4519]"
Note 204536.1 "ORA-600 [4820]"
Note 41840.1 "ORA-600 [4882]"
ORA-600 Errors 6001 to 9000
Note 47449.1 "ORA-600 [6002]"
Note 116552.1 "ORA-600 [6034]"
Note 40640.1 "ORA-600 [6101]"
Note 99300.1 "ORA-600 [6122]"
Note 138913.1 "ORA-600 [6193]"
Note 39399.1 "ORA-600 [6731]"
Note 41719.1 "ORA-600 [6856]"
ORA-600 Errors 9001 to 15000
Note 138325.1 "ORA-600 [12209]"
Note 33174.1 "ORA-600 [12235]"
Note 138332.1 "ORA-600 [12261]"
Note 138340.1 "ORA-600 [12304]"
Note 35928.1 "ORA-600 [12333]"
Note 28229.1 "ORA-600 [12700]"
Note 67496.1 "ORA-600 [13009]"
Note:28185.1 "ORA-600 [13013]"
ORA-600 Errors 15001 to 17000
Note 138428.1 "ORA-600 [15160]"
Note 138430.1 "ORA-600 [15201]"
Note 138431.1 "ORA-600 [15203]"
Note 131186.1 "ORA-600 [15212]"
Note 137266.1 "ORA-600 [15419]"
Note 216277.1 "ORA-600 [15456]"
Note 138457.1 "ORA-600 [15709]"
Note 67490.1 "ORA-600 [15851]"
Note 76528.1 "ORA-600 [15868]"
Note 138499.1 "ORA-600 [16201]"
Note 106607.1 "ORA-600 [16365]"
Note 138523.1 "ORA-600 [16515]"
Note 138526.1 "ORA-600 [16607]"
ORA-600 Errors 17001 to 30000
Note 138537.1 "ORA-600 [17003]"
Note 138541.1 "ORA-600 [17012]"
Note 41472.1 "ORA-600 [17034]"
Note 138554.1 "ORA-600 [17059]"
Note 39616.1 "ORA-600 [17069]"
Note 29616.1 "ORA-600 [17090]"
Note 138565.1 "ORA-600 [17099]"
Note 47411.1 "ORA-600 [17112]"
Note 39453.1 "ORA-600 [17113]"
Note 34782.1 "ORA-600 [17114]"
Note 138576.1 "ORA-600 [17128]"
Note 138580.1 "ORA-600 [17147]"
Note 34781.1 "ORA-600 [17148]"
Note 138586.1 "ORA-600 [17172]"
Note 263110.1 "ORA-600 [17175]"
Note 34779.1 "ORA-600 [17182]"
Note 45725.1 "ORA-600 [17271]"
Note 138597.1 "ORA-600 [17274]"
Note 134139.1 "ORA-600 [17280]"
Note 39361.1 "ORA-600 [17281]"
Note 138602.1 "ORA-600 [17285]"
Note 138621.1 "ORA-600 [17585]"
Note 138640.1 "ORA-600 [18209]"
Note 216278.1 "ORA-600 [18261]"
Note 138678.1 "ORA-600 [20084]"
Note 100073.1 "ORA-600 [25012]"
ORA-600 Errors kc
Note 138981.1 "ORA-600 [kcbgcur_2]"
Note 70097.1 "ORA-600 [kcbgcur_3]"
Note 114058.1 "ORA-600 [kcbgcur_9]"
Note 138990.1 "ORA-600 [kcbgtcr_4]"
Note 138991.1 "ORA-600 [kcbgtcr_5]"
Note 261264.1 "ORA-600 [kcbgtcr]"
Note 248874.1 "ORA-600 [kcbgtcr_6]"
Note 233612.1 "ORA-600 [kcbgtcr_12]"
Note 204512.1 "ORA-600 [kcbnew_3]"
Note 216104.1 "ORA-600 [kcbrbo1]"
Note 139011.1 "ORA-600 [kcbzpb_1]"
Note 139012.1 "ORA-600 [kcbzpb_2]"
Note 229467.1 "ORA-600 [kcbzwb_4]"
Note 139013.1 "ORA-600 [kccsbck_first]"
Note 216108.1 "ORA-600 [kcllcu_0]"
Note 263225.1 "ORA-600 [kclwcrs_15]"
Note 76434.1 "ORA-600 [kcoapl_blkchk]"
Note 248718.1 "ORA-600 [kcratr1_lostwrt]"
ORA-600 Errors kd to kw
Note 139037.1 "ORA-600 [kdddgb2]"
Note 139042.1 "ORA-600 [kdisle:nrows]"
Note 139051.1 "ORA-600 [kghalo2]"
Note 139052.1 "ORA-600 [kghasp1]"
Note 139066.1 "ORA-600 [kghxhdr1]"
Note 229809.1 "ORA-600 [kgliep_1]"
Note 66501.1 "ORA-600 [kkrqtab2]"
Note 139095.1 "ORA-600 [kkslgop1]"
Note 139116.1 "ORA-600 [kohdtf048]"
Note 264061.1 "ORA-600 [kqludp2]"
Note 139162.1 "ORA-600 [kssrmp1]"
Note 247822.1 "ORA-600 [ksmals]"
Note 139153.1 "ORA-600 [ksmguard2]"
Note 233864.1 "ORA-600 [kteuproptime-2]"
Note 139180.1 "ORA-600 [ktsgsp5]"
Note 139193.1 "ORA-600 [kttmupd_segment-]"
Note 228480.1 "ORA-600 [kwqitnmptme:read]"
Note 228480.1 "ORA-600 [kwqitnmptme:ready]"
Note 228364.1 "ORA-600 [kwqitnmptme:wait]"
ORA-600 Errors q to z
Note 248095.1 "ORA-600 [qctcte1]"
Note 216273.1 "ORA-600 [qctstc2o1]"
Note 209363.1 "ORA-600 [qerrmofbu1]"
Note 237598.1 "ORA-600 [qertqtableallocate2]"
Note 226887.1 "ORA-600 [qkagby4]"
Note 222876.1 "ORA-600 [qmxiunppacked2]"
Note 244365.1 "ORA-600 [rworupo.1]"
Note 139263.1 "ORA-600 [srsget_1]"
Note 260951.1 "ORA-600 [ttcgcshnd]"
Note 216452.1 "ORA-600 [ttcgcshnd-1]"
Note 216453.1 "ORA-600 [ttcgcshnd-2]"
ORA-600 Errors 1 to 3000
Note 138300.1 "ORA-600 [105]"
Note 263295.1 "ORA-600 [106]"
Note 28104.1 "ORA-600 [504]"
Note 138871.1 "ORA-600 [510]"
Note 138888.1 "ORA-600 [525]"
Note 138939.1 "ORA-600 [711]"
Note 39308.1 "ORA-600 [723]"
Note 31056.1 "ORA-600 [729]"
Note 131490.1 "ORA-600 [733]"
Note 217860.1 "ORA-600 [1013]"
Note 138123.1 "ORA-600 [1100]"
Note 41767.1 "ORA-600 [1113]"
Note 40514.1 "ORA-600 [1114]"
Note 137262.1 "ORA-600 [1115]"
Note 66387.1 "ORA-600 [1158]"
Note 138354.1 "ORA-600 [1236]"
Note 28045.1 "ORA-600 [2103]"
Note 28929.1 "ORA-600 [2662]"
Note 31057.1 "ORA-600 [2845]"
Note 138733.1 "ORA-600 [2865]"
ORA-600 Errors 3001 to 6000
Note 30866.1 "ORA-600 [3020]"
Note 93665.1 "ORA-600 [3668]"
Note 47456.1 "ORA-600 [4000]"
Note 96642.1 "ORA-600 [4036]"
Note 43914.1 "ORA-600 [4137]"
Note 28226.1 "ORA-600 [4146]"
Note 39282.1 "ORA-600 [4193]"
Note 39283.1 "ORA-600 [4194]"
Note 138822.1 "ORA-600 [4400]"
Note 29702.1 "ORA-600 [4414]"
Note 138836.1 "ORA-600 [4454]"
Note 39553.1 "ORA-600 [4511]"
Note 73455.1 "ORA-600 [4512]"
Note 27955.1 "ORA-600 [4519]"
Note 204536.1 "ORA-600 [4820]"
Note 41840.1 "ORA-600 [4882]"
ORA-600 Errors 6001 to 9000
Note 47449.1 "ORA-600 [6002]"
Note 116552.1 "ORA-600 [6034]"
Note 40640.1 "ORA-600 [6101]"
Note 99300.1 "ORA-600 [6122]"
Note 138913.1 "ORA-600 [6193]"
Note 39399.1 "ORA-600 [6731]"
Note 41719.1 "ORA-600 [6856]"
ORA-600 Errors 9001 to 15000
Note 138325.1 "ORA-600 [12209]"
Note 33174.1 "ORA-600 [12235]"
Note 138332.1 "ORA-600 [12261]"
Note 138340.1 "ORA-600 [12304]"
Note 35928.1 "ORA-600 [12333]"
Note 28229.1 "ORA-600 [12700]"
Note 67496.1 "ORA-600 [13009]"
Note:28185.1 "ORA-600 [13013]"
ORA-600 Errors 15001 to 17000
Note 138428.1 "ORA-600 [15160]"
Note 138430.1 "ORA-600 [15201]"
Note 138431.1 "ORA-600 [15203]"
Note 131186.1 "ORA-600 [15212]"
Note 137266.1 "ORA-600 [15419]"
Note 216277.1 "ORA-600 [15456]"
Note 138457.1 "ORA-600 [15709]"
Note 67490.1 "ORA-600 [15851]"
Note 76528.1 "ORA-600 [15868]"
Note 138499.1 "ORA-600 [16201]"
Note 106607.1 "ORA-600 [16365]"
Note 138523.1 "ORA-600 [16515]"
Note 138526.1 "ORA-600 [16607]"
ORA-600 Errors 17001 to 30000
Note 138537.1 "ORA-600 [17003]"
Note 138541.1 "ORA-600 [17012]"
Note 41472.1 "ORA-600 [17034]"
Note 138554.1 "ORA-600 [17059]"
Note 39616.1 "ORA-600 [17069]"
Note 29616.1 "ORA-600 [17090]"
Note 138565.1 "ORA-600 [17099]"
Note 47411.1 "ORA-600 [17112]"
Note 39453.1 "ORA-600 [17113]"
Note 34782.1 "ORA-600 [17114]"
Note 138576.1 "ORA-600 [17128]"
Note 138580.1 "ORA-600 [17147]"
Note 34781.1 "ORA-600 [17148]"
Note 138586.1 "ORA-600 [17172]"
Note 263110.1 "ORA-600 [17175]"
Note 34779.1 "ORA-600 [17182]"
Note 45725.1 "ORA-600 [17271]"
Note 138597.1 "ORA-600 [17274]"
Note 134139.1 "ORA-600 [17280]"
Note 39361.1 "ORA-600 [17281]"
Note 138602.1 "ORA-600 [17285]"
Note 138621.1 "ORA-600 [17585]"
Note 138640.1 "ORA-600 [18209]"
Note 216278.1 "ORA-600 [18261]"
Note 138678.1 "ORA-600 [20084]"
Note 100073.1 "ORA-600 [25012]"
ORA-600 Errors kc
Note 138981.1 "ORA-600 [kcbgcur_2]"
Note 70097.1 "ORA-600 [kcbgcur_3]"
Note 114058.1 "ORA-600 [kcbgcur_9]"
Note 138990.1 "ORA-600 [kcbgtcr_4]"
Note 138991.1 "ORA-600 [kcbgtcr_5]"
Note 261264.1 "ORA-600 [kcbgtcr]"
Note 248874.1 "ORA-600 [kcbgtcr_6]"
Note 233612.1 "ORA-600 [kcbgtcr_12]"
Note 204512.1 "ORA-600 [kcbnew_3]"
Note 216104.1 "ORA-600 [kcbrbo1]"
Note 139011.1 "ORA-600 [kcbzpb_1]"
Note 139012.1 "ORA-600 [kcbzpb_2]"
Note 229467.1 "ORA-600 [kcbzwb_4]"
Note 139013.1 "ORA-600 [kccsbck_first]"
Note 216108.1 "ORA-600 [kcllcu_0]"
Note 263225.1 "ORA-600 [kclwcrs_15]"
Note 76434.1 "ORA-600 [kcoapl_blkchk]"
Note 248718.1 "ORA-600 [kcratr1_lostwrt]"
ORA-600 Errors kd to kw
Note 139037.1 "ORA-600 [kdddgb2]"
Note 139042.1 "ORA-600 [kdisle:nrows]"
Note 139051.1 "ORA-600 [kghalo2]"
Note 139052.1 "ORA-600 [kghasp1]"
Note 139066.1 "ORA-600 [kghxhdr1]"
Note 229809.1 "ORA-600 [kgliep_1]"
Note 66501.1 "ORA-600 [kkrqtab2]"
Note 139095.1 "ORA-600 [kkslgop1]"
Note 139116.1 "ORA-600 [kohdtf048]"
Note 264061.1 "ORA-600 [kqludp2]"
Note 139162.1 "ORA-600 [kssrmp1]"
Note 247822.1 "ORA-600 [ksmals]"
Note 139153.1 "ORA-600 [ksmguard2]"
Note 233864.1 "ORA-600 [kteuproptime-2]"
Note 139180.1 "ORA-600 [ktsgsp5]"
Note 139193.1 "ORA-600 [kttmupd_segment-]"
Note 228480.1 "ORA-600 [kwqitnmptme:read]"
Note 228480.1 "ORA-600 [kwqitnmptme:ready]"
Note 228364.1 "ORA-600 [kwqitnmptme:wait]"
ORA-600 Errors q to z
Note 248095.1 "ORA-600 [qctcte1]"
Note 216273.1 "ORA-600 [qctstc2o1]"
Note 209363.1 "ORA-600 [qerrmofbu1]"
Note 237598.1 "ORA-600 [qertqtableallocate2]"
Note 226887.1 "ORA-600 [qkagby4]"
Note 222876.1 "ORA-600 [qmxiunppacked2]"
Note 244365.1 "ORA-600 [rworupo.1]"
Note 139263.1 "ORA-600 [srsget_1]"
Note 260951.1 "ORA-600 [ttcgcshnd]"
Note 216452.1 "ORA-600 [ttcgcshnd-1]"
Note 216453.1 "ORA-600 [ttcgcshnd-2]"
Subscribe to:
Posts (Atom)