Nothing Special   »   [go: up one dir, main page]

04-RAC DB Administration Overview

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Oracle RAC DB Administration Overview

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Objectives

After completing this lesson, you should be able to:


• Define redo log files in a RAC environment
• Define undo tablespaces in a RAC environment
• Start and stop RAC databases and instances
• Modify initialization parameters in a RAC environment

4-2 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
Redo Log Files and RAC

Node1 Node2
RAC01 RAC02

Shared storage

Group 1 SPFILE
… Group 4

Group 2 RAC01.THREAD=1
Group 5
RAC02.THREAD=2
Group 3 …
Thread 2
Thread 1

4-3 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
Automatic Undo Management and RAC
Pending Node1 Node2
offline
RAC01 RAC02

Consistent reads
Transaction recovery

Shared storage

undotbs3
… SPFILE

RAC01.UNDO_TABLESPACE=undotbs1
RAC02.UNDO_TABLESPACE=undotbs2
undotbs1 undotbs2

ALTER SYSTEM SET UNDO_TABLESPACE=undotbs_prd1 SID='RAC01';

4-4 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
Starting and Stopping RAC Instances

• Multiple instances can open the same database


simultaneously.
• Shutting down one instance does not interfere with other
running instances.
• RAC instances can be started and stopped by using:
– Enterprise Manager
– The Server Control (srvctl) utility
– SQL*Plus
• Shutting down a RAC database means shutting down all
instances accessing the database.

4-5 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
Starting and Stopping
RAC Instances with srvctl
• start/stop syntax:
$ srvctl start instance -db db_unique_name –node node_name
-instance instance_name_list[-startoption
open|mount|nomount|normal|transactional|immediate|abort]

srvctl start|stop database -db <db_name> -eval


[-startoption
open|mount|nomount|normal|transactional|immediate|abort>]

• Examples:
$ srvctl start instance -db orcl -instance orcl1,orcl2

$ srvctl stop instance -db orcl -instance orcl1,orcl2

$ srvctl start database -db orcl -startoption open

$ srvctl start instance -db orcl -node host01


*** This command will start a Policy-Managed database****

4-6 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
Starting and Stopping
RAC Instances with SQL*Plus
[host01] $ echo $ORACLE_SID
orcl1
sqlplus / as sysdba
SQL> startup
SQL> shutdown

[host02] $ echo $ORACLE_SID


orcl2
sqlplus / as sysdba
SQL> startup
SQL> shutdown

4-7 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
Switch Between Automatic
and Manual Policies
$ srvctl config database -db orcl -a
Database unique name: orcl
Database name: orcl
Oracle home: /oracle/product/19c
Oracle user: oracle
Spfile: +DATA/orcl/spfileorcl.ora
Password file: +DATA/orcl/orapworcl
Domain: cluster01.example.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: orcldb
Database instances:
Disk Groups:
Mount point paths:
Services:
Type: RAC
...

srvctl modify database -db orcl -policy MANUAL;

4-8 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
RAC Initialization Parameter Files

• An SPFILE is created if you use the DBCA.


• The SPFILE must be created in an ASM disk group or a
cluster file system file.
• All instances use the same SPFILE.
• If the database is created manually, create an SPFILE
from a PFILE.

Node1 Node2
RAC01 RAC02
initRAC01.ora initRAC02.ora
SPFILE=… SPFILE=…
SPFILE

4-9 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
SPFILE Parameter Values and RAC

• You can change parameter settings using the ALTER


SYSTEM SET command from any instance:
ALTER SYSTEM SET <dpname> SCOPE=MEMORY sid='<sid|*>';
• SPFILE entries such as:
– *.<pname> apply to all instances
– <sid>.<pname> apply only to <sid>
– <sid>.<pname> takes precedence over *.<pname>
• Use current or future *.<dpname> settings for <sid>:
ALTER SYSTEM RESET <dpname> SCOPE=MEMORY sid='<sid>';

• Remove an entry from your SPFILE:


ALTER SYSTEM RESET <dpname> SCOPE=SPFILE sid='<sid|*>';

4 - 10 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Parameter File Search Order in Oracle RAC

• On Linux and UNIX platforms, the search order is as


follows:
1. $ORACLE_HOME/dbs/spfilesid.ora
2. $ORACLE_HOME/dbs/spfile.ora
3. $ORACLE_HOME/dbs/initsid.ora
• On Windows platforms, the search order is as follows:
1. %ORACLE_HOME%\database\spfilesid.ora
2. %ORACLE_HOME%\database\spfile.ora
3. %ORACLE_HOME%\database\initsid.ora

4 - 11 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Parameters That Require Identical Settings

• COMPATIBLE
• CLUSTER_DATABASE
• CONTROL_FILES
• DB_BLOCK_SIZE
• DB_DOMAIN
• DB_FILES
• DB_NAME
• DB_RECOVERY_FILE_DEST
• DB_RECOVERY_FILE_DEST_SIZE
• DB_UNIQUE_NAME
• INSTANCE_TYPE (RDBMS or ASM)
• PARALLEL_EXECUTION_MESSAGE_SIZE
• REMOTE_LOGIN_PASSWORDFILE
• UNDO_MANAGEMENT

4 - 12 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Parameters That Require Unique Settings

Instance settings:
• INSTANCE_NAME
• INSTANCE_NUMBER
• UNDO_TABLESPACE
• THREAD
• ROLLBACK_SEGMENTS

4 - 13 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Terminating Sessions on a Specific Instance
SQL> SELECT SID, SERIAL#, INST_ID
2 FROM GV$SESSION WHERE USERNAME='JMW';
SID SERIAL# INST_ID
---------- ---------- ----------
140 3340 2
SQL> ALTER SYSTEM KILL SESSION '140,3340,@2';
System altered.
SQL>

ALTER SYSTEM KILL SESSION '140,3340,@2'


*
ERROR at line 1:
ORA-00031: session marked for kill

4 - 14 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


How SQL*Plus Commands Affect Instances

SQL*Plus Command Associated Instance


ARCHIVE LOG Generally affects to the database
CONNECT Affects the default instance if no instance is specified
in the CONNECT command
RECOVER Does not affect any particular instance, but rather the
database
SHOW PARAMETER and Show the current instance parameter and SGA
SHOW SGA information
STARTUP and Affect the current instance
SHUTDOWN
SHOW INSTANCE Displays information about the current instance

4 - 15 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Transparent Data Encryption and Keystores in
RAC
• One wallet shared by all instances on shared storage:
– No additional administration is required.
• One copy of the keystore on each local storage:
– Local copies need to be synchronized each time master key
is changed.

ALTER SYSTEM SET ENCRYPTION KEY 1

Keystore Keystore Keystore


Manual
copy
Master keys Master key Master key

2
Node1 Node2 Noden

Manual copy

4 - 16 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Quiz

Which of the following statements is not true?


a. Multiple instances can open the same database
simultaneously.
b. Shutting down one instance does not interfere with other
running instances.
c. SHUTDOWN TRANSACTIONAL LOCAL will wait for other
instances’ transactions to finish.
d. Shutting down a RAC database means shutting down all
instances accessing the database.

4 - 17 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


Summary

In this lesson, you should have learned how to:


• Define redo log files in a RAC environment
• Define undo tablespaces in a RAC environment
• Start and stop RAC databases and instances
• Modify initialization parameters in a RAC environment

4 - 18 Copyright © 2019, Oracle and/or its affiliates. All rights reserved.

You might also like