Managing an Oracle Instance

初始化参数文件:

-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 <comment=‘text‘>

<deferred> <scope=memory|spfile|both><sid=‘sid|*‘>

提示:若命令中不使用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 <scope=memory|spfile|both> 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 localPFILE 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 usingadministrator 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=<file_name>]

[MOUNT [EXCLUSIVE] <database_name>x |

OPEN <READ {ONLY | WRITE [RECOER]} | RECOVER><database_name>

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 restrictedmode:

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

时间: 2024-08-29 12:04:11

Managing an Oracle Instance的相关文章

Oracle Instance

文章为学习汇总网上资料 instance = 内存结构(SGA,system global area) +后台进程 内存结构 = 共享池+数据高速缓存+重做日志缓冲区+其他 后台进程 = DBWn(database writer n个)+LGWR(log writers)+SMON(system monniter)+PMON(progress moniter)+CKPT(checkpoint)+-- PGA(Program Global Area)= 服务器进程+后台进程 下面分别介绍各部分:

升级数据字典,解决ORA-01092: ORACLE instance terminated. Disconnection forced问题

在oracle 实例关闭的情况下,Oracle 软件从10.2.0.1 升级到 10.2.0.5 之后,存在的数据库也要升级. 此时启动实例会报错 ORA-01092: ORACLE instance terminated. Disconnection forced SQL> alter database open; ERROR at line 1: ORA-01092: ORACLE instance terminated. Disconnection forced 第一步,通过startup

配置oracle instance client

1,下载oracle instance client.http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html 由于机器是64位的,所以下载了64位版本.但后面发现plsql是32位的,又下载了32位版本.两个版本可以并行存在,绿色版的嘛... 2,下载后,解压到c盘或其它目录下.其中_x86是32位版本. 3,配置环境变量. Path:增加instance client解压的目录.

AIX上 断开的NFS 挂载点 导致 Oracle instance hang 住

翻译自mos文章:Disconnected NFS Mount Point Causes Instance to Hang on AIX (文档 ID 1445600.1) 适用于: Oracle Server - Enterprise Edition - Version: 10.2.0.1 and later   [Release: 10.2 and later ] IBM AIX on POWER Systems (64-bit) IBM AIX on POWER Systems (32-b

ORACLE AUTOMATIC STORAGE MANAGEMENT翻译-第二章 ASM instance(1)

第二章  ASM INSTANCE ASM的类型,例如可以: 10g后ORACLE instance 类型增加了一个ASM种类.参数INSTANCE_TYPE=ASM进行设置. ASM实例启动命令: startup nomount启动实例和后台进程.但没有挂载磁盘组 mount以后.实例会启动參数文件里ASM_DISKGROUPS指定的磁盘组,假设參数为空就会触发ORA-15110报错信息. ASM 11G以后为mount命令引入了restricted启动參数.以排他方式启动ASM_DISKGR

Oracle ASM学习之(1)--ASM Instance管理

Oracle ASM学习之(1)--ASM Instance管理    About Oracle ASM Instances An Oracle ASM instance is built on the same technology as an Oracle Database instance. An Oracle ASM instance has a System Global Area (SGA) and background processes that are similar to t

oracle db shutdown immediate&ndash;multi Instance

[[email protected] ~]$ sqlplus / as [email protected] SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 6 21:14:51 2015 Copyright (c) 1982, 2009, Oracle.  All rights reserved. Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -

浅谈ORACLE AWR single instance 一

Oracle中的AWR,全称为Automatic Workload Repository,自动负载信息库. AWR是DBA了解其运行状态的重要工具之一,根据AWR报告可以对oracle数据库性能整体了解并针对性优化,此文章主要是介绍AWR相关部分的内容. DB Name         DB Id    Instance     Inst Num Startup Time    Release     RAC ------------ ----------- ------------ -----

Linux/Unix shell 监控Oracle实例(monitor instance)

使用shell脚本实现对Oracle数据库的监控与管理将大大简化DBA的工作负担,如常见的对实例的监控,监听的监控,告警日志的监控,以及数据库的备份,AWR report的自动邮件等.本文给出Linux 下使用 shell 脚本来监控 Oracle 实例. Linux Shell的相关参考:        Linux/Unix shell 脚本中调用SQL,RMAN脚本        Linux/Unix shell sql 之间传递变量        Linux/Unix shell 调用 P