Oracle数据库如何启动与关闭
小编给大家分享一下Oracle数据库如何启动与关闭,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
创新互联-专业网站定制、快速模板网站建设、高性价比察雅网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式察雅网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖察雅地区。费用合理售后完善,十多年实体公司更值得信赖。
C:\app\Administrator\virtual\product\12.2.0\dbhome_2\bin>dir oracle.exe 驱动器 C 中的卷没有标签。
卷的序列号是 7E62-AB2D
C:\app\Administrator\virtual\product\12.2.0\dbhome_2\bin 的目录
2017/03/08 13:41 291,897,344 oracle.exe
1 个文件 291,897,344 字节
0 个目录 59,988,402,176 可用字节
c:\>sqlplus /nolog
SQL*Plus: Release 12.2.0.1.0 Production on 星期四 1月 4 09:51:46 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
SQL> conn / as sysdba
已连接到空闲例程。
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 2768240640 bytes
Fixed Size 8922760 bytes
Variable Size 704645496 bytes
Database Buffers 2046820352 bytes Redo Buffers 7852032 bytes
2018-01-04T09:52:29.405663+08:00
Starting ORACLE instance (normal) (OS id: 23276)
2018-01-04T09:52:29.405663+08:00
CLI notifier numLatches:3 maxDescs:519
2018-01-04T09:52:29.419240+08:00
All SGA segments were allocated at startup
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
2018-01-04T09:52:30.403967+08:00
Initial number of CPU is 1
Number of processor cores in the system is 1
Number of processor sockets in the system is 1
Using LOG_ARCHIVE_DEST_1 parameter default value as C:\app\Administrator\virtual\product\12.2.0\dbhome_2\RDBMS
Autotune of undo retention is turned on.
IMODE=BR
ILAT =51
LICENSE_MAX_USERS = 0
SYS auditing is enabled
2018-01-04T09:52:30.674253+08:00
NOTE: remote asm mode is local (mode 0x1; from cluster type)
2018-01-04T09:52:34.865321+08:00
NOTE: Using default ASM root directory ASM
NOTE: Cluster configuration type = NONE [2]
NUMA system with 2 nodes detected
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production.
Windows NT Version V6.2
ORACLE_HOME = C:\app\Administrator\virtual\product\12.2.0\dbhome_2
Node name : WIN-6NLPRCEFFBK
CPU : 1 - type 8664, 1 Physical Cores
Process Affinity : 0x0x0000000000000000
Memory (Avail/Total): Ph:
VM name : VMWare Version (6)
Using parameter settings in server-side spfile C:\APP\ADMINISTRATOR\VIRTUAL\PRODUCT\12.2.0\DBHOME_2\DATABASE\SPFILENEWTEST.ORA
System parameters with non-default values:
processes = 300
nls_language = "SIMPLIFIED CHINESE"
nls_territory = "CHINA"
sga_target = 2640M
control_files = "C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CONTROL01.CTL"
control_files = "C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CONTROL02.CTL"
db_block_size = 8192
compatible = "12.2.0"
db_create_file_dest = "C:\app\Administrator\virtual\oradata"
undo_tablespace = "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
dispatchers = "(PROTOCOL=TCP) (SERVICE=newtestXDB)"
local_listener = "LISTENER_NEWTEST"
audit_file_dest = "C:\APP\ADMINISTRATOR\VIRTUAL\ADMIN\NEWTEST\ADUMP"
audit_trail = "DB"
db_name = "newtest"
open_cursors = 300
pga_aggregate_target = 878M
diagnostic_dest = "C:\APP\ADMINISTRATOR\VIRTUAL"
enable_pluggable_database= TRUE
NOTE: remote asm mode is local (mode 0x1; from cluster type)
2018-01-04T09:52:34.906339+08:00
NOTE: PatchLevel of this instance 0
2018-01-04T09:52:36.278960+08:00
Starting background process PMON
2018-01-04T09:52:36.278960+08:00
PMON started with pid=2, OS id=23656
Starting background process CLMN
2018-01-04T09:52:36.311667+08:00
CLMN started with pid=3, OS id=23788
Starting background process PSP0
Starting background process VKTM
2018-01-04T09:52:36.325501+08:00
PSP0 started with pid=4, OS id=24392
2018-01-04T09:52:37.345560+08:00
VKTM started with pid=5, OS id=23596 at elevated (Time Critical) priority
2018-01-04T09:52:37.345560+08:00
VKTM running at (5)millisec precision with DBRM quantum (100)ms
2018-01-04T09:52:37.345560+08:00
Starting background process GEN0
2018-01-04T09:52:37.434916+08:00
GEN0 started with pid=6, OS id=24180
Starting background process MMAN
2018-01-04T09:52:37.497468+08:00
MMAN started with pid=8, OS id=23800
Starting background process GEN1
2018-01-04T09:52:37.528700+08:00
GEN1 started with pid=9, OS id=24540
Starting background process DIAG
2018-01-04T09:52:37.575494+08:00
DIAG started with pid=10, OS id=18772
Starting background process OFSD
Starting background process DBRM
2018-01-04T09:52:37.593249+08:00
OFSD started with pid=11, OS id=18340
2018-01-04T09:52:37.606837+08:00
Oracle running with ofslib:'?' version=2
Starting background process VKRM
2018-01-04T09:52:37.622450+08:00
DBRM started with pid=12, OS id=24436
2018-01-04T09:52:37.638003+08:00
VKRM started with pid=11, OS id=23268
Starting background process SVCB
Starting background process PMAN
2018-01-04T09:52:37.669385+08:00
SVCB started with pid=13, OS id=19252
2018-01-04T09:52:37.700555+08:00
PMAN started with pid=14, OS id=18576
Starting background process DIA0
Starting background process DBW0
2018-01-04T09:52:37.719259+08:00
DIA0 started with pid=15, OS id=23156
Starting background process LGWR
2018-01-04T09:52:37.779935+08:00
DBW0 started with pid=16, OS id=24520
2018-01-04T09:52:37.794271+08:00
LGWR started with pid=17, OS id=24464
Starting background process CKPT
Starting background process SMON
2018-01-04T09:52:37.825503+08:00
CKPT started with pid=18, OS id=15632
2018-01-04T09:52:37.841120+08:00
SMON started with pid=19, OS id=19436
Starting background process SMCO
Starting background process RECO
2018-01-04T09:52:37.872548+08:00
SMCO started with pid=20, OS id=23940
2018-01-04T09:52:37.888087+08:00
RECO started with pid=21, OS id=22084
Starting background process LREG
2018-01-04T09:52:37.934875+08:00
LREG started with pid=7, OS id=23696
Starting background process PXMN
2018-01-04T09:52:37.966140+08:00
PXMN started with pid=24, OS id=23760
Starting background process FENC
2018-01-04T09:52:37.981756+08:00
FENC started with pid=25, OS id=24060
Starting background process MMON
2018-01-04T09:52:37.997371+08:00
MMON started with pid=26, OS id=23084
Starting background process MMNL
2018-01-04T09:52:38.013067+08:00
MMNL started with pid=27, OS id=24460
2018-01-04T09:52:38.013067+08:00
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
starting up 1 shared server(s) ...
Starting background process TMON
2018-01-04T09:52:38.059907+08:00
TMON started with pid=30, OS id=23636
ORACLE_BASE from environment = C:\app\Administrator\virtual
2018-01-04T09:52:40.622915+08:00
Using default pga_aggregate_limit of 2048 MB
Oracle12C体系结构
5个重要组成部分
连接数据库实例的服务:为Oracle系统的体系结构中协同工作的方式;
服务器进程;
文件系统管理;
内存区域管理:尤其是系统全局区(SGA,SystemGlobal Area)的特点和作用;
后台进程
3个重点体系结构
内存结构,进程结构,存储结构
通过上图,可以看出每一个Oracle服务器都会包含两个主要组成部分,即Oracle实例,Oracle数据库(物理体系)
Oracle服务器,Oracle实例(instance),Oracle数据库(database)的关系
实例与数据库的关系是数据库可以由多个实例装载和打开,而实例可以在任何时间点上装载,打开一个数据库;
如将Oracle比作一辆汽车,那么实例就像汽车的发动机(核心),在启动Oracle之前一定要保证实例先启动,而汽车上所拉的货物就是数据库;
Oracle实例体系
数据库启动,会自动分配SGA(系统全局区)内存,构成Oracle的内存结构,而后再启动若干个常驻内存的操作系统进程,已构成Oracel的进程结构,内存区域与后台进程就构成了一个Oracle实例;
每个运行的Oracle数据库都对应一个Oracle实例(或者称为例程)。每个实例启动时都会分配各自的内存结构与进程结构;
Oracle实例标记:在操作系统中如果存在多个Oracle实例(实例名称不可以相同),那么可以使用ORACLE_SID(或者使用INSTANCE_NAME)这个环境属性进行默认使用实例的标注;
内存结构
内存存储了数据字典信息,关于对象,逻辑结构,权限等元数据,缓冲的应用数据,SQL语句,PL/SQL和Java程序数据,以及事务等信息。除了这些,还包含软件代码区和程序代码区(PGA)
共享区
(1). 包括高速缓冲区,和数据字典缓冲区,数据库高速缓冲区又包括共享sql区,私有sql区,共享PL/SQL区,及控制结构区
1). 私有sql区:用来存放sql语句执行时与之有关的每一个会话的私有数据。在专用服务器中,私有sql区存在PGA中,在共享服务器内,私有SQL区存在共享区中;
2). 共享SQL区:用户执行sql时,Oracle会将最近执行的sql语句的文本,编译后的语法分析树和执行计划存入共享区。而将sql语句中的变量值存入私有Sql区。当服务器再次执行相同的sql语句时,服务器进程将不再进行语句分析,而是直接执行共享sql区内已经存在的内容;
3). 共享PL/SQL区:Oracel执行一个PL/SQL语句前,会先将程序单元放入共享PL/SQL区,而程序单元内的SQL语句将被放到SQL区中,当需要再次执行相同的程序单元时,直接从内存中调用,不用再次访问磁盘;
4). 结构控制区:供实例内部使用的一段内存区,存放了锁方面的信息;数据库缓冲区
(1). 该区是SGA中的一个高速缓冲区域,用来存储最近从数据文件中读取的数据块,表,索引数据库。当用户处理查询时,服务器进程会先从数据库缓冲区查找所需要的数据库,缓冲区中没有时才会访问磁盘数据;重做日志缓冲区
(1). 当用户通过sql语句更改数据后,服务器进程会在重做日志缓冲区中记录这些修改。数据库发生意外后,可通过此记录恢复数据大池
(1). 可选的内存区。大池提供额外的内存,供一些消耗大量内存的操作使用;Java池
(1). 该处存放了Java文本,语法分析等信息。如果要安装Java VM就必须启用Java池;Streams池
(1). 该区域是10g新添加的。它用来存放信息。它存放的内容是共享的。利用该池管理信息比原来捕获和管理消息更容易;数据字典缓冲区
(1). 它包含了数据库的结构,用户信息和数据库的表,视图等信息;还有所有表和视图的名词,以及权限等信息;程序全局区(PGA)
(1). 程序全局区:包括会话信息,堆栈空间,排序区以及游标状态;
1). 会话信息存放的是会话的权限,角色,会话性能统计等信息;
2). 堆栈空间内存放的是变量,数组和属于会话的其他信息;
3). 排序区则是用于排序的一段专用空间;
4). 游标状态存放的则是当前使用的各种游标的处理阶段;
(2). 当用户进程连接到Oracle后,服务器会创建一个会话,同时分配一个PGA区,该区由一个用户进程使用,不能共享;
1). 对专用服务器(一个数据库连接对应一个专用服务器进程),PGA保存堆栈空间信息,会话信息,游标状态和排序区。
2). 对共享服务器,PGA仅保存堆栈空间信息,而会话信息,游标状态,排序区保存在SGA中。
3). PGA结构如图:
A.
3种类型的进程
用户进程,服务器进程和后台进程,用户进程与服务器进程的关系,如图
(1).
(2). 当用户需要在Oracle进行操作时,首先要建立连接,从而建立用户进程与服务器进程之间的通信通道。当用户与服务器建立了连接之后,就会通过一个会话来表示,不同会话间的操作彼此独立;
(3). Oracle的后台进程与实例同时启动,主要作用是维持数据库的物理结构和内存结构,后台进程的结构如下上图主要的后台进程作用如下:
(1). 系统监控进程(SMON):数据库启动时,SMON会使用联机重做日志文件恢复崩溃的实例;
(2). 进程监控进程(PMON):主要是监视用户进程的运行;当用户进程失败时,清除用户进程和进程所占用的资源;
(3). 检查点进程(CKPT):用来控制数据文件,控制文件和重做日志文件之间的协调同步;
(4). 数据库写进程(DBWO):此进程负责管理数据库缓冲区以及数据字典缓冲区;
(5). 日志写进程(LOWR):负责重做日志缓冲区的内容写入联机重做日志文件;
(6). 归档进程(ARCO):将写满的重做日志文件转存到指定的设备上,以保证先前的重做日志文件不至于被覆盖;
(7). 恢复进程(RECO):用于恢复分布式数据库环境中失败的事务;
(8). 作业队列进程(SNPn):可以完成一些应用程序的周期性执行工作。
(9). 锁进程(LCKn):用于锁定数据库对象,不被数据库其他进程更改。
Oracle物理体系
该体系就是数据库的物理体系,就是存放在磁盘上的结构文件;在数据库中的所有数据,都保存在这些物理文件中;
控制文件(Control file):控制文件用于控制数据库的物理结构。它记录了数据库中所有文件的控制信息;
数据文件(Data File):每个Oracle数据库都有一个或多个物理的数据文件。一个数据库的数据文件包含全部数据库数据。
重做日志文件(Log File):Oracle用重做日志文件来保存所有数据库事务的日志;
参数文件(Parameter File):保存Oracle配置有关的信息,一般有如下3类参数文件:
(1). 初始化参数文件:用于在数据库启动实例时配置数据库,该文件主要设置数据库实例名称,主要使用文件的位置,实例所需要的内存区域大小等;
(2). 配置参数文件:在数据对应多个实例的时候才会存在,如果一个数据库只对应一个实例则不会产生此文件。此文件一般被命名为config.org,该文件一般由初始化参数文件调用;
(3). 二进制参数文件:会存在两种参数文件,一种是pfile,此文件是基于文本格式化的参数文件,含有数据库的配置参数。另一种Server Parameter File,服务器参数文件,此文件是基于二进制格式的参数文件,含有数据库及例程的参数和数值;
SQL> col addr format A20
SQL> col pid format 999
SQL> col spid format 999999
SQL> col username format A25
SQL> col program format A105
SQL> set line 550
SQL> select addr,pid,spid,username,program from v$process;
ADDR PID SPID USERN
AME PROGRAM
00007FF9D0C06870 1
PSEUDO
00007FF9D0C07948 2 23656 Oracl
eServiceNE ORACLE.EXE (PMON)
00007FF9D0C08A20 3 23788 Oracl
eServiceNE ORACLE.EXE (CLMN)
00007FF9D0C09AF8 4 24392 Oracl
eServiceNE ORACLE.EXE (PSP0)
00007FF9D0C0ABD0 5 23596 Oracl
eServiceNE ORACLE.EXE (VKTM)
00007FF9D0C0BCA8 6 24180 Oracl
eServiceNE ORACLE.EXE (GEN0)
00007FF9D0C0CD80 7 23696 Oracl
eServiceNE ORACLE.EXE (LREG)
00007FF9D0C0DE58 8 23800 Oracl
eServiceNE ORACLE.EXE (MMAN)
00007FF9D0C0EF30 9 24540 Oracl
eServiceNE ORACLE.EXE (GEN1)
00007FF9D0C10008 10 18772 Oracl
eServiceNE ORACLE.EXE (DIAG)
00007FF9D0C110E0 11 23268 Oracl
eServiceNE ORACLE.EXE (VKRM)
ADDR PID SPID USERN
AME PROGRAM
00007FF9D0C121B8 12 24436 Oracl
eServiceNE ORACLE.EXE (DBRM)
00007FF9D0C13290 13 19252 Oracl
eServiceNE ORACLE.EXE (SVCB)
00007FF9D0C14368 14 18576 Oracl
eServiceNE ORACLE.EXE (PMAN)
00007FF9D0C15440 15 23156 Oracl
eServiceNE ORACLE.EXE (DIA0)
00007FF9D0C16518 16 24520 Oracl
eServiceNE ORACLE.EXE (DBW0)
00007FF9D0C175F0 17 24464 Oracl
eServiceNE ORACLE.EXE (LGWR)
00007FF9D0C186C8 18 15632 Oracl
eServiceNE ORACLE.EXE (CKPT)
00007FF9D0C197A0 19 19436 Oracl
eServiceNE ORACLE.EXE (SMON)
00007FF9D0C1A878 20 25312 Oracl
eServiceNE ORACLE.EXE (SHAD)
00007FF9D0C1B950 21 22084 Oracl
eServiceNE ORACLE.EXE (RECO)
00007FF9D0C1CA28 22 24356 Oracl
eServiceNE ORACLE.EXE (SHAD)
ADDR PID SPID USERN
AME PROGRAM
00007FF9D0C1EBD8 24 23760 Oracl
eServiceNE ORACLE.EXE (PXMN)
00007FF9D0C20D88 26 23084 Oracl
eServiceNE ORACLE.EXE (MMON)
00007FF9D0C21E60 27 24460 Oracl
eServiceNE ORACLE.EXE (MMNL)
00007FF9D0C22F38 28 19328 Oracl
eServiceNE ORACLE.EXE (D000)
00007FF9D0C24010 29 24404 Oracl
eServiceNE ORACLE.EXE (S000)
00007FF9D0C250E8 30 23636 Oracl
eServiceNE ORACLE.EXE (TMON)
已选择 28 行。
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------ spfile string C:\APP\ADMINISTRATOR\VIRTUAL\P
RODUCT\12.2.0\DBHOME_2\DATABAS
E\SPFILENEWTEST.ORA
关闭数据库,删除spfile文件
SQL> startup nomount ORA-01078: failure in processing system parameters
LRM-00109: ???????????????? 'C:\APP\ADMINISTRATOR\VIRTUAL\PRODUCT\12.2.0\DBHOME_2\DATABASE\INITNEWTEST.ORA'
还原文件
C:\app\Administrator\virtual\product\12.2.0\dbhome_2\bin>rman target /
恢复管理器: Release 12.2.0.1.0 - Production on 星期五 1月 5 10:08:17 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
已连接到目标数据库 (未启动)
RMAN> startup nomount;
Oracle 实例已启动
系统全局区域总计 2768240640 字节
Fixed Size 8922760 字节
Variable Size 704645496 字节
Database Buffers 2046820352 字节
Redo Buffers 7852032 字节
RMAN> host;
Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。
C:\app\Administrator\virtual\product\12.2.0\dbhome_2\bin>sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on 星期五 1月 5 10:10:01 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
连接到:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show parameter db_name;
NAME TYPE VALUE
db_name string newtest
SQL> show parameter control_files;
NAME TYPE VALUE
control_files string C:\APP\ADMINISTRATOR\VIRTUAL\O
RADATA\NEWTEST\CONTROL01.CTL,
C:\APP\ADMINISTRATOR\VIRTUAL\O
RADATA\NEWTEST\CONTROL02.CTL
SQL> select status from v$instance;
STATUS
STARTED
SQL> select open_mode from v$database;
select open_mode from v$database
第 1 行出现错误:
ORA-01507: 未装载数据库
SQL> select from v$controlfile;
未选定行
SQL> alter database mount;
数据库已更改。
SQL> set line 200
SQL> col name format A60
SQL> select * from v$controlfile;
STATUS NAME IS_
EC BLOCK_SIZE FILE_SIZE_BLKS CON_ID
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CONTROL01.CTL NO 16384 1142 0 C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CONTROL02.CTL NO 16384 1142 0
SQL> shutdown immediate
ORA-01109: 数据库未打开
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area 2768240640 bytes
Fixed Size 8922760 bytes
Variable Size 704645496 bytes
Database Buffers 2046820352 bytes
Redo Buffers 7852032 bytes
ORA-00205: ?????????, ??????, ???????
SQL> shutdown immediate
ORA-01507: ??????
ORACLE 例程已经关闭。
SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area 2768240640 bytes
Fixed Size 8922760 bytes
Variable Size 704645496 bytes
Database Buffers 2046820352 bytes
Redo Buffers 7852032 bytes
数据库装载完毕。
SQL> set line 100
SQL> col name format A100
SQL> select name from v$datafile;
NAME
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\SYSTEM01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBSEED\SYSTEM01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\SYSAUX01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBSEED\SYSAUX01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\UNDOTBS01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBSEED\UNDOTBS01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\USERS01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\SYSTEM01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\SYSAUX01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\UNDOTBS01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\USERS01.DBF
NAME
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB_PLUG\SYSTEM01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB_PLUG\SYSAUX01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB_PLUG\UNDOTBS01.DBF
C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB_PLUG\USERS01.DBF
已选择 15 行。
SQL> col name format A20
SQL> select con_id, dbid, name , open_mode from v$pdbs;
CON_ID DBID NAME OPEN_MODE
2 603865257 PDB$SEED MOUNTED 3 3394996704 PDBTEST MOUNTED 4 50957894 CLONEPDB_PLUG MOUNTED SQL> shutdown immediate
ORA-01109: 数据库未打开
已经卸载数据库。
ORACLE 例程已经关闭。
SQL>
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 2768240640 bytes
Fixed Size 8922760 bytes
Variable Size 704645496 bytes
Database Buffers 2046820352 bytes
Redo Buffers 7852032 bytes
SQL> select con_id, dbid, name , open_mode from v$pdbs;
未选定行
SQL> alter database mount;
数据库已更改。
SQL> shutdown immediate
ORA-01109: ??????
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area 2768240640 bytes
Fixed Size 8922760 bytes
Variable Size 704645496 bytes
Database Buffers 2046820352 bytes
Redo Buffers 7852032 bytes
数据库装载完毕。
实际情况无报错
日志一样无报错
看来12c还是有不同
书原文
SQL> select file# from v$recover_file;
FILE#
7
SQL> select name from v$datafile where FILE#=7;
NAME
C:\APP\ADMINISTRATOR
\VIRTUAL\ORADATA\NEW
TEST\USERS01.DBF
看来以后要以这个表查询为主
查询后日志出现
Successful mount of redo thread 1, with mount id 1781505083
2018-01-05T11:04:31.454611+08:00
Database mounted in Exclusive Mode
Lost write protection disabled
Using STANDBY_ARCHIVE_DEST parameter default value as C:\app\Administrator\virtual\product\12.2.0\dbhome_2\RDBMS
Completed: ALTER DATABASE MOUNT
刚才错误也返回
12c无报错
SQL> alter database open;
数据库已更改。
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
2 PDB$SEED READ ONLY NO 3 PDBTEST MOUNTED 4 CLONEPDB_PLUG MOUNTED alter system checkpoint,是执行检查点,搜索buffer cache 中的dirst listy,然后将脏数据写入data file,以及将redo buffers log写入online log,同时更新控制文件以及数据文件头部scn等信息。
alter system flush buffer_cache,相当于把buffer cache 重新刷新了以便,你可以把buffer cache 比喻成一个盒子,原来有乱起八糟的东西,你这一刷新原来的没有了,可以装新的东西了!但不会更新scn信息。
SQL> show parameter background_
NAME TYPE VALUE
background_core_dump string partial
background_dump_dest string C:\APP\ADMINISTRATOR
\VIRTUAL\P
RODUCT\12.2.0\DBHOME
_2\RDBMS\T
RACE
SQL> select * from v$version where rownum<2;
BANNER
CON_ID
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
0
SQL> show parameter diag
NAME TYPE VALUE
diagnostic_dest string C:\APP\ADMINISTRATOR
\VIRTUAL
SQL> SELECT * FROM V$DIAG_INFO;
INST_ID NAME VALUE CON_ID
1 Diag Enabled TRUE 0 1 ADR Base C:\APP\ADMINISTRATOR\VIRTUAL 0 1 ADR Home C:\APP\ADMINISTRATOR\VIRTUAL\diag\rdbms\newtest\newtest 0 1 Diag Trace C:\APP\ADMINISTRATOR\VIRTUAL\diag\rdbms\newtest\newtest\trace 0 1 Diag Alert C:\APP\ADMINISTRATOR\VIRTUAL\diag\rdbms\newtest\newtest\alert 0 1 Diag Incident C:\APP\ADMINISTRATOR\VIRTUAL\diag\rdbms\newtest\newtest\incident 0 1 Diag Cdump C:\app\Administrator\virtual\diag\rdbms\newtest\newtest\cdump 0 1 Health Monitor C:\APP\ADMINISTRATOR\VIRTUAL\diag\rdbms\newtest\newtest\hm 0 1 Default Trace File C:\APP\ADMINISTRATOR\VIRTUAL\diag\rdbms\newtest\newtest\trace\newtest_ora_26280. 0 1 Active Problem Count 1 0 1 Active Incident Count 1 0
11 rows selected
adrci> set homepath diag\rdbms\newtest\newtest
adrci> show alert -tail 20
2018-01-05 14:13:32.216000 +08:00
Endian type of dictionary set to little
Undo initialization finished serial:0 start:2003502593 end:2003502593 diff:0 ms
(0.0 seconds)
Database Characterset for PDB$SEED is UTF8
2018-01-05 14:13:34.682000 +08:00
Opatch validation is skipped for PDB PDB$SEED (con_id=0)
2018-01-05 14:13:36.604000 +08:00
Opening pdb with no Resource Manager plan active
2018-01-05 14:13:38.653000 +08:00
Starting background process CJQ0
CJQ0 started with pid=44, OS id=25888
Completed: alter database open
2018-01-05 14:17:41.903000 +08:00
Shared IO Pool defaulting to 144MB. Trying to get it from Buffer Cache for proce
ss 19412.
Dumping current patch information
No patches have been applied
2018-01-05 14:18:02.081000 +08:00
TABLE SYS.WRP$_REPORTS: ADDED INTERVAL PARTITION SYS_P636 (2927) VALUES LESS THA
N (TO_DATE(' 2018-01-06 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGO
RIAN'))
TABLE SYS.WRP$_REPORTS_DETAILS: ADDED INTERVAL PARTITION SYS_P637 (2927) VALUES
LESS THAN (TO_DATE(' 2018-01-06 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALEND
AR=GREGORIAN'))
TABLE SYS.WRP$_REPORTS_TIME_BANDS: ADDED INTERVAL PARTITION SYS_P640 (2926) VALU
ES LESS THAN (TO_DATE(' 2018-01-05 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CAL
ENDAR=GREGORIAN'))
2018-01-05 14:48:48.251000 +08:00
Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter.
Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter.
2018-01-05 14:48:52.501000 +08:00
Using deprecated SQLNET.ALLOWED_LOGON_VERSION parameter.
C:\app\Administrator\virtual>adrci
ADRCI: Release 12.2.0.1.0 - Production on 星期五 1月 5 15:01:33 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
ADR base = "C:\app\Administrator\virtual"
adrci> show incident
ADR Home = C:\app\Administrator\virtual\diag\clients\user_Administrator\host_194
152873_107:
0 rows fetched
ADR Home = C:\app\Administrator\virtual\diag\clients\user_OracleServiceORCL\host
_194152873_107:
INCIDENT_ID PROBLEM_KEY
CREATE_TIME
1 oci 24550 [3221225477]
2017-12-12 14:59:54.769000 +08:00
ADR Home = C:\app\Administrator\virtual\diag\rdbms\newtest\newtest:
INCIDENT_ID PROBLEM_KEY
CREATE_TIME
16969 ORA 6544 [pevm_peruws_callback-1]
2017-12-20 10:50:07.983000 +08:00
ADR Home = C:\app\Administrator\virtual\diag\rdbms\orcl\orcl:
0 rows fetched
ADR Home = C:\app\Administrator\virtual\diag\tnslsnr\WIN-6NLPRCEFFBK\listener:
0 rows fetched
ADR Home = C:\app\Administrator\virtual\diag\tnslsnr\WIN-6NLPRCEFFBK\orcl:
0 rows fetched
newtest=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.5.204)(PORT = 9200))
)
(CONNECT_DATA =
(SERVICE_NAME = newtest)
)
)
C:\Users\Administrator>tnsping newtest
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 05-JAN-2018 15:17:56
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
名称栏目:Oracle数据库如何启动与关闭
分享地址:http://myzitong.com/article/jejoss.html