小布老师讲座笔记(三)
STARTUP Command Behavior
Order of precedence(启动顺序)
—spfileSID.ora
—Default SPFILE ->spfile.ora
—initSID.ora
—Default PFILE -> ???
Specified PFILE can override precedence.
STARTUP PFILE = $ORACLE_HOME/dbs/initDBA1.ora
PFILE can indicate to use SPFILE.
SPFILE = /database/startup/spfileDBA1.ora(通过pfile找到spfile)
Starting Up a Database
MOUNT(limit ) |
NOMOUNT |
SHUTDOWN |
opened for the instanc
All files opened as described
by the control file for this instance
OPEN |
STARTUP FORECE STARTUP RESTRICT
ALTER SYSTEM ENABLE RESTRICTED SESSION;
[oracle@linux dbs]$ lsnrctl start
create user boobooke identified by bbk;
grant connect, resource to boobooke;
远端连接:
sqlplus boobooke/bbk@oracle9ivm(this is a describor)
select * from dual;
sqlplus system/oracle@oracle9ivm
查看所有连接数据库的用户:
select sid, serial#, username from v$session;
管理员杀掉用户:
alter system kill session ’15,6’;
Read-Only Mode
Opening a database in read-only mode;
startup mount;
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
Shutting Down the Databases;
Close a database
When you close a database, Oracle Database writes all database data and recovery data in the SGA to the datafiles and redo log files, respectively; When you close a database, Oracle writes all database data and recovery data in the SGA to the datafiles and redo log files, respectively. Next, Oracle closes all online datafiles and redo log files. (Any offline datafiles of any offline tablespaces have been closed already. If you subsequently reopen the database, any tablespace that was offline and its datafiles remain offline and closed, respectively.) At this point, the database is closed and inaccessible for normal operations. The control files remain open after a database is closed but still mounted.
Unmount a Database
After the database is closed, Oracle unmounts the database to disassociate it from the instance. At this point, the instance remains in the memory of your computer.
After a database is unmounted, Oracle closes the control files of the database
Shut Down an Instance
The final step in database shutdown is shutting down the instance. When you shut down an instance, the SGA is removed from memory and the background processes are terminated.
Shutting Down the Database
Shutdown Mode | A | I | T | N |
Allow new connection | NO | No | No | No
|
Wait until current session end | No | NO | NO | Yes
|
Wait until current tansaction end | No | NO | Yes | Yes |
Force a checkpoint and close files | No | Yes | Yes | Yes |
Shutdown mode:
A ABORT I = IMMEDIATE T TRANSACTIONAL N = NORMAL
startup:
Online redo log files used to reapply changes
Undo segments used to roll back uncommitted changes
Resources released
Diagnostic Files
—Contain information about significant events encountered
—Used to resolve problems
-Used to better manage the database on a day-to-day basis
Several types exist:
—altertSID.log file
—Background trace files
—User trace files
Enable/Disable User Tracing
Session level:
—Using the alter session command:
—alter session set sql_trace = true
—Executing DBMS procedure:
—dbms_system.SET_SQL_TEACE_IN_SESSION
—Instance level
—Setting the initialization parameter:
—SQL_TRACE = TRUE
(SHUTDOWN NORMAL OR SHUTDOWN TRANSACTIONAL OR SHUTDOWN IMMEDIATE), on these way down:
★ Database buffer cache written to the data files
★ Uncommitted changes rolled back
★ Resources released
on the way up No instance recovery
(shutdown abort or instance failure or startup force),on the vay Modified buffers are not written to the data files Uncommitted changes are not rollback.
on the way up:
Online redo log files used to reapply changes
Undo segments used to rollback uncommitted changes Resources released
日志文件存放地点:
background_dump_dest string /u01/admin/denver/bdump