CONTROL FILE , LOCKS AND OMF






Control File:
-------------

      --> it inludes details like how many datafiles,redolog files and their             
           staus

      --> checkpoint will write status of datafile and redolog files


--> how add mirror
    --------------
 
      --> edit the parameter file(init.ora).
   
      --> add another file path to control_files.
     


--> Creating control file:
    ----------------------

     --> by using the backup of control file we can create the control file if it
         damaged or corrupted.

      --> for backup the control file
    
            SQL> alter database backup controlfile to trace;
           
            SQL> recover database using backup controlfile;


 LOCKS:
 ------

  --> LOACKS ARE MANAGED BY THE ORACLE INTERNALLY

  --> LOCAKS ARE TWO TYPE

        --> DDL LOCKS
        --> DML LOCAKS
                --> EXCLUSIVE LOCKS FOR RECORD LEVEL
        --> ROW EXCLUSIVE FOR TABLE LEVEL

  --> LOCAKSD CAN BE
        
         --> IMPLICIT LOCKS
     --> EXPLICT LOCKS
     
              EX: LOCK TABLE EMP IN EXCLUSIVE MODE;
          ---
  --> LOCKS SOMETIMES CAUSE TO DEAD LOCKS

         --> THER WE HAVE TO KILL THE ANY ONE SESSION EITHER BLOCKER OR WAITER

 
 
  --> IN LOCKS

        BLOCKER --> WHO BLOCKS THE RESOURCE
    WAITER ---> WHO IS WATING FOR THE RESOURCE

  --> DICTIONARY VIEWS

    DBA_LOCKS     --> FOR ALL LOCKS
   
    V$LOCKS       --> ORIGINAL TABLE

        DBA_DDL_LOCKS --> DDL LOCKS

    DBA_DML_LOCKS --> DML LOCKS
   
    DBA_BLOCKERS  --> FOR BLOCKERS

    DBA_WAITERS   --> FOR WAITERS

    V$SESSIONS    --> FOR SESSIONS

  --> EXAMPLE FOR KILLING A SESSION

      SQL> ALTER SYSTEM KILL SESSION '144,51' IMMEDIATE;

         --> FOR THIS WE HAVE TO  GIVE SID(SESSION ID) AND SERIAL









 OMF(ORACLE MANAGED FILES):
 --------------------------

  
   --> PARAMETERS FOR OMF IN INIT.ORA

         FOR DATAFILES --> DBA_CREATE_FILE_DEST

     FOR REDOLOGS  --> DBA_CREATE_ONLINE_LOG_DEST_1           
               DBA_CREATE_ONLINE_LOG_DEST_2

  --> if set these parameters in init.ora

         --> no need to tel path for tablespaces,datafile and redolog files
     --> even if u not tel size also it will take default size
     --> even if u not specify also if will create datafiles with name     

   --> DEFAULT SIZE IS 100MB

              
   ---> database creation                


        SQL> CREATE DATABASE "surendra"
        MAXINSTANCES 8
        MAXLOGHISTORY 1
        MAXLOGFILES 16
        MAXLOGMEMBERS 3
        MAXDATAFILES 100
        DATAFILE SIZE 300M AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED
        EXTENT MANAGEMENT LOCAL
        SYSAUX DATAFILE SIZE 120M AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED
        SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M AUTOEXTEND ON         NEXT  640K MAXSIZE UNLIMITED
        SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE SIZE 200M AUTOEXTEND ON NEXT          5120K MAXSIZE UNLIMITED
        CHARACTER SET WE8MSWIN1252
        NATIONAL CHARACTER SET AL16UTF16
        LOGFILE GROUP 1  SIZE 51200K,
        GROUP 2  SIZE 51200K,
        GROUP 3  SIZE 51200K
        USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY                 "&&systemPassword";
        set linesize 2048;
        column ctl_files NEW_VALUE ctl_files;
        select concat('control_files=''', concat(replace(value, ', ', ''','''),             '''')) ctl_files from v$parameter where name ='control_files';
        host "echo &ctl_files                 >>D:\oracle\product\10.2.0\admin\surendra\scripts\init.ora";

   --> FOR CREATING TABLESPACE


        SQL> CREATE TABLESPACE SALES;

    SQL> CREATE TABLESPACEPURCHASE DATAFILE SIZE 200M;

No comments:

Post a Comment