管理ORACLE实例
admin
2023-05-11 22:02:02
0次


初始化参数文件:

-PFILE:Static parameter file,PFILE

-SPFILE:Persistent server parameter file,SPFILE

 

PFILE-- initSID.ora

·Text file

·Modified with an operating system editor

·Modifications made manually

·Changes take effect on the next start up

·Only opened during instance startup

·Default location is $ORACLE_HOME/dbs

 

 

Creating a PFILE

·Created from a sample init.ora  file

-Sample installed by the Oracle Universal Installer(OUI)

-Copy sample using operating system copy command

-Uniquely identified by database SID

$ cp $ORACLE_HOME/dbs/init.ora $ORACLE_HOME/dbs/initexample.ora

·Mofify the initSID.ora

-Edit the parameters

-Specific to database needs

·Example

-Creating a pfile from spfile.

SQL> create pfile from spfile'

 

 

 

SPFILE– spfileSID.ora
·Binary file

·Maintained by the Oracle server

·Always resides on the server side

·Ability to make changes persistent across shutdown and start up

·Can self-tune parameter vallues

·Can have Recovery Manager support backing up to the initialization parameter file

 

 

Creteing an SPFILE

·Created from a PFILE file

  SQL> create spfile='$ORACLE_HOME/dbs/spfileexample.ora’from                         pfile='$ORACLE_HOME/dbs/initexample.ora’

·Can be executed before or after instance start up

 

 

Modify Parameters in SPFILE:

SQL> ALTER system set parameter=value

提示:若命令中不使用scope选项,scope选项缺省为both。

SQL> alter system set fast_start_mttr_target=250 comment='hello world';

$ strings examplespfile.ora

 

DEFERRED(延迟生效)

SQL> select name,issys_modifiable from v$parameter where issys_modifiable='DEFERRED';

 

 

Modify Parameters in SPFILE

·Changing parameter values

SQL> alter system set undo_tablespace=undots02;

·Specifying temporary or persistent changes

SQL> alter system set undo_tablespace=undots02 scope=both;

·Deleting or resetting values

  SQL> alter system reset parameter_name sid='*';

 

 

 

SPFILE vs PFILE:

1.An SPFILE can be backed-up with RMAN(RMAN cannot backupPFILEs).

2.Reduce human errors.The SPFILE is maintained by theserver. Parameters are checked before changes are accepted.

3.Eliminate configuration problems(no need to have a local PFILE if you want to start Oracle from a remote machine).

4.Easy to find stored in a central location($ORACLE_HOME/dbs).

Note: SPFILE is better than PFILE!

 

 

 

STARTUP Command Behavior

·Order of precedence:

-spfileSID.ora

-Default SPFILE → spfile.ora

-initSID.ora

·Specified PFILE can override precedence.

SQL> STARTUP PFILE=$ORACLE_HOME/dbs/initexample.ora

·PFILE can indicate to use SPFILE.

  $ cat $ORACLE_HOME/dbs/initDBA1.ORA

    spfile=$ORACLE_HOME/dbs/spfileDBA1.ora

 

 

 

Who can start the database?

Database startup and shutdown are powerful administrative options and are restricted to users who connect to Oracle Database with administrator privileges. Depending on the operating system, one of the following conditions establishes administrator privileges for a user:

·The users's operating system privileges allow him or her to connect using administrator privileges.

·The user is granted the SYSDBA or SYSOPER privileges and the database users

password files to authenticate database administrators.

When you connect with SYSDBA privileges, you are in the schema owned by SYS. When you connect as SYSOPER, you are in the public schema. SYSOPER privileges are subset of SYSDBA privileges.

 

 

 

Starting Up a Database

参考联机文档:

http://docs.oracle.com/cd/E11882_01/server.112/e40540/startup.htm#CNCPT005

 

 

STARTUP Command

Start up the instance and open the database:

SQL> STARTUP;

SQL> STARTUP PFILE=$ORACLE_HOME/dbs/initdb01.ora;

 

STARTUP [FORCE] [RESTRICT] [NOMOUNT] [MIGRATE] [QUIET][PFILE=]

[MOUNT [EXCLUSIVE] x |

OPEN

 

 

 

ALTER DATABASE Command

·Change the state of the database from NOMOUNT to MOUNT:

  SQL> ALTER DATABASE MOUNT;

·Open the database as a read-only database:

  SQL> ALTER DATABASE OPEN READ ONLY;

 

 

 

Restricted Mode:

·Use the STARTUP command to restrict access to a database;

SQL> STARTUP RESTRICT;

·Use the ALTER SYSTEM command to place an instance in restricted mode:

SQL> alter system enable restricted session;

SQL> alter system disable restricted session;

 

杀掉某一进程会话:

SQL> select sid,serial#,username from v$session;

SQL> alter system kill session '40,9';  ## 40,9表示SID,SERIAL。

 

 

 

Read-OnlyMode

·Opening a database in read-only mode:

SQL> startup mount;

SQL> alter database open read only;

·Can be used to:

  -Execute queries

  -Execute disk sorts using locally managed tablespaces

  -Take data files offline and online, but not tablespaces

  -Perform recovery of offline data files and tablespaces

 

 

 

ShuttingDown the Database


Database Behavior

ABORT

IMMEDIATE

TRANSACTIONAL

NORMAL

Permits new user connections

No

No

No

No

Waits until current sessions end

No

No

No

Yes

Waits until current transactions end

No

No

Yes

Yes

Performs a checkpoint  and closes open files

No

Yes

Yes

Yes

 

SQL> shutdown abort;

SQL> shutdown immediate;

SQL> shutdown transactional;

SQL> shutdown normal;

 

 

 

DiagnosticFiles

·Diagnostic files

  - Contain information about significant events

  - Used to resolve problems

  - Used to better manage the database on a day-to-day basis

·Several types exist:

  - alertSID.log file

  - Background tracefiles

  - User trace files

 

Alert Log File

·alertSID.log file:

  - Records the commands

  - Records results of major events

  - Used for day-to-day operational information

  - Used for diagnosingd atabase errors

·Each entry has a time stamp associated with it

·Must be managed by DBA

·Location defined by BACKGROUND_DUMP_DEST

SQL> show parameter background_dump_dest;

 

 

 

Enable/DisabledUser Tracing

·Session level:

-Using the ALTERSESSION command:

SQL> alter session set sql_trace = true

·Instance level:

-Setting the initialization parameter:

SQL_TRACE = TRUE


相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...