tab_spaces

download tab_spaces

of 3

Transcript of tab_spaces

  • 8/7/2019 tab_spaces

    1/3

    ORACLE DBA

    BASIC :

    STEP 1 root@dba19 ~]# su oracleSTEP 2 [oracle@dba19 /]$ cd $ORACLE_HOMESTEP 3 [oracle@dba19 db_2]$ lsSTEP 4 oracle@dba19 ~]$ sqlplusEnter user-name: / as sysdbaSQL> startup

    MULTIPLEXING CONTROL_FILES USING SPFILE.STEP1:STARTUP DATABASE SQL> startup

    1.show parameter spfile;2.show parameter control_files;

    3.alter system set control_files='/dbfiles/oracle/oracle/product/10.2.0/db_2/oradata/db1/control01.ctl/dbfiles/oracle/oracle/product/10.2.0/db_2/oradata/db1/control02.ctl,/dbfiles/oracle/oracle/product /10.2.0/db_2/oradata/db1/control03.ctl'scope=spfile;

    SHUT IMMEDIATESQL> shut immediateSTEP2:Making a duplicate copies of control_files in

    different memory locations.ba19 ~]$ cd $ORACLE_HOME/oradata

    [oracle@dba19 oradata]$ ls

    db1

  • 8/7/2019 tab_spaces

    2/3

    [oracle@dba19 oradata]$ cd db1/

    [oracle@dba19 db1]$ cp control01.ctl control03.ctl

    Enable/Disable Archive Log Mode 10g/11g

    Note: It is recommended to perform a backup of the database (after a shutdown normal orimmediate) prior to changing thearchive status of a database.

    Enable Archive Log ModeThe following are the steps required to enable archivelogmode on an Oracle 10g or11g database.Verify the database logmode.$ sqlplus / assysdbaStartupThe log mode is No Archive Mode. Note that Archive destination is USE_DB_RECOVERY_FILE_DEST .You can determine the path by looking at the parameterRECOVERY_FILE_DEST .SQL> show parameter recovery_file_dest

    By default, archive logs will be written to the flash recovery area. If you do not want to write archivelogsto the flash recovery area you can set the parameterLOG_ARCHIVE_DEST_n to the location in which youwish to write archivelogs.altersystem setlog_archive_dest_1='LOCATION=/u02/app/oracle/oradata/orcl/arch' scope =both;

    System altered.archive log list;

    Now we shutdown the database and bring it backup in mount mode.SQL> shutdown immediate

    Lastly all that is needed it set archivelogmode and open the database

    SQL> alterdatabasearchivelog;

    Databasealtered.

    DisableArchiveLogModeNote: It is recommended to perform a backup of the database (after a shutdown normal or

    immediate) prior to changing thearchive status of a database.

    The following are the steps required to disablearchivelogmode on an Oracle 10g

    or 11g database.

    Verify the database logmode.[oracle@ora1 ~]$ sqlplus / assysdbaThe Database logmode is Archive mode. Next we shut down the database and bring up back up inmount mode.SQL> shutdown immediate

    All that is left is to disablearchivelogmode and open the database.

  • 8/7/2019 tab_spaces

    3/3

    alterdatabasenoarchivelog;SQL> alterdatabaseopen

    Manageing tablespaces and datafilesdesc dba_tablespaces;

    desc dba_data_files;desc dba_extents;

    select a.file_id,b.file_name,b.autoextensible,b.bytes/1024/1024,sum(a.bytes)/1024/1024from dba_extents a , dba_data_files b

    where a.file_id=b.file_id

    group by a.file_id,b.file_name,b.autoextensible,b.bytes/1024/1024

    create table space.

    create tablespace test datafile

    '/dbfiles/oracle/oracle/product/10.2.0/db_2/oradata/db1/test01.dbf' size 10m autoextendon next 5m maxsize 200m

    SQL> /

    Tablespace created.

    Locally managed tablespacesCreate table space local datafile

    '/dbfiles/oracle/oracle/product/10.2.0/db_2/oradata/db1/local01.dbf' size 50m extent

    management local uniform size 256k

    SQL> /

    Tablespace created.