Tuesday, August 18, 2020

Oracle RAC File System

 Oracle RAC File System:


DB Instance status

. db_env

SQL> select inst_id,instance_number,status,instance_name from gv$instance;


gv$database - Db up and running.

SQL> select inst_id,name,open_mode from gv$database;


Using srvctl - tool - manage database resources


$srvctl status database -d prod


Finding instance status in RAC

$ srvctl status instance  -d prod -i prod1


How to start/stop/status - instance in RAC


$ srvctl stop instance -d prod -i prod2

$ srvctl status instance  -d prod -i prod1,prod2

$ srvctl start instance -d prod -i prod2


To shutdown database and all instances

$srvctl stop database -d prod -o immediate

$srvctl start database -d prod -o open

$ srvctl config database -d prod


RAC files:


In rac, using OMF concept (oracle managed files) . Oracle will assign


the file name and location to store in asm.


using parameter db_create_file_dest


sql>show parameter db_create_file_dest


db_create_file_dest                  string      +DATA


+DATA is the diskgroup associated with disks physically in ASM.

    setting this parameter, oracle will store files in diskgroup


default.


Creating tablespace :


sql>select file_name from dba_data_files;

sql>select tablespace_name from dba_tablespaces;

sql>create tablespace utbs datafile '/oradata/prod/ctbs01.dbf' size

100m autoextend on maxsize unlimited;


using diskgroups

sql>create tablespace ractbs;

sql>create tablespace ctbs datafile '+DATA' size 100m autoextend on maxsize unlimited;

sql>alter tablespace ctbs add datafile '+DATA' size 100m;

sql>alter tablespace ctbs add datafile '+DATA';


SQL> drop tablespace CTBS including contents and datafiles;

sql>show parameter db_create_file_dest

        +DATA


SQL> create tablespace ractbs;


sql>select


file_name,autoextensible,bytes/1024/1024,maxbytes/1024/1024 from


dba_data_files where tablespace_name like 'CTBS';


    default 100m , auto,max32gb


or else , we can explicity use the location with .dbf


sql>create tablespace mtbs datafile '+DATA/prod/datafile/catbs01.dbf'


size 100m;


Adding datafiles:


sql>alter tablespace ractbs add datafile '+DATA' size 100m autoextend


on maxsize unlimited;


with out

sql>alter tablespace ractbs add datafile


'+DATA/prod/datafile/ractbs03.dbf' size 100m;



For Undo Management :


purpose : to hold old images for read consistency


    Every instance has own undo tablespace

 

    rac1 - prod1 - undoractbs1

    rac2 - prod2 - undoractbs2

        define retention of every instance independently


        or using sid='*' applicable for all instances.


sql>select tablespace_name from dba_tablespaces where tablespacE_name like 'UNDO%';


Adding datafile for undo


sql>alter tablespace undotbs1 add datafile '+DATA' size 100m;

SQL> select tablespace_name from dba_tablespaces where tablespace_name like 'UNDO%';

or

sql>alter tablespace undoractbs1 add datafile;

or

sql>create undo tablespace undoractbs3;


Login to instance prod1, same in other instances.

sql>show parameter undo_tablespace

sql>show parameter undo_retention


Redo Management



using parameter db_create_online_log_dest_1=+DATA

        db_create_online_log_dest_2=+FRA


    set the destination of redo using OMF



 redo is associated with every instance with thread#

    thread# from gv$instance

Redo groups are created independently for every instance.

each Instance has default two redo groups


SQL> select thread#,instance_number,instance_name from gv$instance;


sql>select thread#,group#,bytes/1024/1024,members from gv$log


Maintain same number of group# and size of every instance logs.


SQL> column REDOLOG_FILE_NAME format a50;


SQL> set lines 1000

SQL> SELECT a.GROUP#, a.THREAD#, a.SEQUENCE#,

 a.ARCHIVED, a.STATUS, b.MEMBER AS REDOLOG_FILE_NAME,

 (a.BYTES/1024/1024) AS SIZE_MB FROM v$log a

JOIN v$logfile b ON a.Group#=b.Group#

ORDER BY a.GROUP#;


SQL> ALTER DATABASE ADD LOGFILE THREAD 1

GROUP 5 '+DATA' SIZE 100m,

GROUP 6 '+FRA' SIZE 100m;



SQL>

SQL> ALTER DATABASE ADD LOGFILE THREAD 2

GROUP 7 '+DATA' SIZE 100m,

GROUP 8 '+FRA' SIZE 100m;



5-8groups approc each instance. with 2gb each member


Enable Archivelogs - FRA diskgroup


Configure +FRA- by adding diskgroups using asmca or sql>


alter system set db_recovery_file_dest_size=5G scope=both sid='*';


alter system set db_recovery_file_dest='+DATA' scope=both sid='*';



bring down db and do the change in any one of the instance of a db.

$srvctl stop database -d prod

on rac1

sql>startup mount

or

$srvctl start instance -d prod -i prod1 -o mount

sql>alter database archivelog;

sql>alter database open;

$srvctl start instance -d prod -i prod2,prod3



RAC - DB files


using db_create_file_dest parameter will set the diskgroup

so can create tablespace / add datafile with out specifying the filename/location.


will auto allocate the file name with file number in diskgroup configured globally.

using OMF concept.(oracle managed files).


eg: +DATA

db_create_file_dest=+DATA

. db_env

sql>create tablespace rtbs;


asmcmd>ls


  a file number is associated with every asm file when added as per OMF.


Redo/Undo


Abt redo and undo are independent associated with that instance.


If rac1 - then using thread# - redo and undo are associated.

1       1,2     undoractbs1

   rac2 - then using thread#

2 3,4 undoractbs2

   rac3 - 3 5,6 undoractbs3


so add new 9 redo groups each instance with min 3 with size 1/2G


Unix level , can start/stop/status of instance/db using srvctl.



Note :Info on Oracle RAC Files it may be differ from your environment production,testing,development and naming conventions etc,Unix level , can start/stop/status of instance/db using srvctl.


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME OR SUBSCRIBE ME


ORA-01536: Space Quotas Exceeded for Table Space for a Particular User

 ORA-01536: Space Quotas Exceeded for Table Space for a Particular User


Problem


while creating the table or insert the data values into the table user is getting an error  ORA-01536 :space quota exceeded for tablesapce


sql> create table accountmaster tablespace smalltbs as select * from dba_objects;


create table accountmaster tablespace smalltbs as select * from dba_objects;

*

ERROR at line 1;

ORA-01536 : space quota exceeded for tablespace 'SMALLTBS'


Solution


Table space quota is the allocated in a particular user in tablespace, Once the particular user reaches the max allocated space it shows error like this


SQL>select tablespace_name,username,bytes/1024/1024,max_bytes/1024/1024 from dba_ts_quotas where username like 'CHAITANYA';


TABLESPACE_NAME       USER_NAME  BYTES/1024/1024   MAX_BYTES /1024/1024

-------------------------------------------------------------------------------------------------------------


SMALLTBS                         CHAITANYA               18                          25



Here CHAITANYA user can have maximum upto 25 MB space  of SMALLTBS tablespace but currently  it reaches used upto 18 MB



SQL> create table accountmaster tablespace smalltbs as select * from dba_objects;


create table accountmaster tablespace smalltbs as select * from dba_objects;

*

ERROR at line 1;

ORA-01536 : space quota exceeded for tablespace 'SMALLTBS'



Let us start the  process to start the fix it and increase the quota for that user 'CHAITANYA'


SQL> alter user CHAITANYA quota 100M on SMALLTBS;


user altered


SQL>select tablespace_name,username,bytes/1024/1024,max_bytes/1024/1024 from dba_ts_quotas where username like 'CHAITANYA';


TABLESPACE_NAME       USER_NAME  BYTES/1024/1024   MAX_BYTES /1024/1024

-------------------------------------------------------------------------------------------------------------


SMALLTBS                         CHAITANYA               18                         100


Now create the table and insert the table values into that particular user


SQL> create table accountmaster tablespace smalltbs as select * from dba_objects;


create table accountmaster tablespace smalltbs as select * from dba_objects;


table created sucessfully



SQL>select tablespace_name,username,bytes/1024/1024,max_bytes/1024/1024 from dba_ts_quotas where username like 'CHAITANYA';


TABLESPACE_NAME       USER_NAME  BYTES/1024/1024   MAX_BYTES /1024/1024

-------------------------------------------------------------------------------------------------------------


SMALLTBS                         CHAITANYA               30                        100




THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME OR SUBSCRIBE ME




ITIL Process

ITIL Process Introduction In this Blog i am going to explain  ITIL Process, ITIL stands for Information Technology Infrastructure Library ...