Tuesday, June 18, 2013

Kill Oracle Sessions.

Identify the Session.

===========================================

SQL> SELECT USERNAME, SID, SERIAL#, STATUS FROM V$SESSION;

USERNAME                              SID    SERIAL# STATUS
------------------------------ ---------- ---------- --------
                                        1          1 ACTIVE
                                        2          1 ACTIVE
                                        3          1 ACTIVE
                                        4          1 ACTIVE
SYSMAN                                  6        110 INACTIVE
                                       10          1 ACTIVE
MICR                                   11         47 INACTIVE
                                       64          1 ACTIVE
                                       65          1 ACTIVE
                                       66          1 ACTIVE
                                       67         26 ACTIVE

USERNAME                              SID    SERIAL# STATUS
------------------------------ ---------- ---------- --------
                                       68          1 ACTIVE
SYSMAN                                 69          1 INACTIVE
                                      125          1 ACTIVE
                                      126          1 ACTIVE
                                      127          1 ACTIVE
                                      128          1 ACTIVE
                                      130          3 ACTIVE
SYSMAN                                133         15 INACTIVE
                                      137         42 ACTIVE
SYSMAN                                139          3 ACTIVE
                                      187          1 ACTIVE

USERNAME                              SID    SERIAL# STATUS
------------------------------ ---------- ---------- --------
                                      188          1 ACTIVE
                                      189          1 ACTIVE
                                      190          1 ACTIVE
                                      194         21 ACTIVE
SYS                                   200        151 ACTIVE
SYSMAN                                202         10 INACTIVE

28 rows selected.

KILLING SESSION
==============================================


SQL> ALTER SYSTEM KILL SESSION '11,47';

System altered.

In a RAC environment, you optionally specify the INST_ID

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#,@inst_id';
 

Sunday, June 9, 2013

SYSDBA or SYSOPER system privileges.

SYSDBA or SYSOPER system privileges. These are special administrative privileges that allow an administrator to perform basic database administration tasks, such as creating the database and instance startup and shutdown..

SYSDBA 
==============================================
Perform STARTUP and SHUTDOWN operations
ALTER DATABASE: open, mount, back up, or change character set
CREATE DATABASE
DROP DATABASE
CREATE SPFILE
ALTER DATABASE ARCHIVELOG
ALTER DATABASE RECOVER
Includes the RESTRICTED SESSION privilege

SYSOPER 
==============================================

Perform STARTUP and SHUTDOWN operations
CREATE SPFILE
ALTER DATABASE OPEN/MOUNT/BACKUP
ALTER DATABASE ARCHIVELOG
ALTER DATABASE RECOVER
Includes the RESTRICTED SESSION privilege

Tuesday, June 4, 2013

ORA-28056: Writing audit records to Windows Event Log failed

SQL> conn /as sysdba
ERROR:
ORA-28056: Writing audit records to Windows Event Log failed
ORA-28056: Writing audit records to Windows Event Log failed
SQL> startup
ORA-28056: Writing audit records to Windows Event Log failed
OSD-158714908: Message 158714908 not found;  product=RDBMS; facility=SOSD

O/S-Error: (OS 1502) The event log file is full.



This was because the Event Viewer log is full and could not log anymore events.
The solution is to clear the event log as follows Control Panel->Administrative Tools->Event Viewer->Clear All Events





Now connect Your Database.
SQL> conn /as sysdba
Connected.
SQL>

Sunday, June 2, 2013

Moving Table Between Tablespace.

############### Creating Table Using Table Space #########

CREATE TABLE TEST_DATA_MOVE(ID NUMBER, NAME VARCHAR2(30)) TABLESPACE MICR;

############# Moving Tablespace  ###################

ALTER TABLE TEST_DATA_MOVE MOVE TABLESPACE MICRACK;

This is ensure your data also move with tablespace.