oracle表启用online,Oracle数据库启动与关闭

70ad3ecc9a739aabd96fe59d5245e3d2.png

c84ae428fa1700979098c8a44c17731e.png

4eb8e1cf9d2000934a8b50ff27cc388e.png

0a00c8e4ca15cd4089c67a23602bdca4.png

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 可用字节

45c82f3e254259be009c0f1420ed47bd.png

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

b420af73f7eb4828a4935fcda458d247.png

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

15964d9d96c198e68bd974e4794934f6.png

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

68b96256b748ba1a1a23980b5b165444.png

Oracle12C体系结构

5个重要组成部分

连接数据库实例的服务:为Oracle系统的体系结构中协同工作的方式;

服务器进程;

文件系统管理;

内存区域管理:尤其是系统全局区(SGA,SystemGlobal Area)的特点和作用;

后台进程

3个重点体系结构

内存结构,进程结构,存储结构

945fe4d108b8c59e5c2dbf151f64fdc4.png

通过上图,可以看出每一个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)

49678171ddffc744d099b3adb003b9ef.png

共享区

(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.

017c8f4167e51af526f741961ab196fb.png

3种类型的进程

用户进程,服务器进程和后台进程,用户进程与服务器进程的关系,如图

(1).

795c2c7a113ec1f643143a90c814b1d0.png

(2). 当用户需要在Oracle进行操作时,首先要建立连接,从而建立用户进程与服务器进程之间的通信通道。当用户与服务器建立了连接之后,就会通过一个会话来表示,不同会话间的操作彼此独立;

(3). Oracle的后台进程与实例同时启动,主要作用是维持数据库的物理结构和内存结构,后台进程的结构如下

0ed17479353f31a723b6fe969b8c33c8.png

上图主要的后台进程作用如下:

(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,服务器参数文件,此文件是基于二进制格式的参数文件,含有数据库及例程的参数和数值;

9af2d52a7cc16e89f31758cbe15db908.png

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 行。

9a4a899820af19b112863b361085cc71.png

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'

997284f37d6fdcf2170bd97d6ca3deb3.png

f23c08b5454fa6d13ee03052573806a1.png

还原文件

fa083e2d2f7e6440927ca00a03f2d8fe.png

fe982cfe4069f08e2a7307027665a014.png

fde9b49bc4ee5df27d9827ca9631fdb4.png

eef4f3c0ecd85c06e5e64b2503df31ee.png

168c1429624ae37b35d64b3bfbfcbaa1.png

e2ade8ec1130bcfe87d3f9f670daac04.png

ce857c580110e2771373bd125f64004c.png

ae7adcbb9564ca305950914fdef188a6.png

553a2f06316806c58247472e42f8a5f6.png

00f7aa038d54e3f684986d8ab8482f86.png

632866515f425fe4f9f095d992ee67d3.png

4784e4942b771c99360bda08c8a5b560.png

a43df740e5367fb610a6f7a5710b438b.png

c67a40101339aec4e8b5ce7deb385734.png

32ff54b254743d3ebc1f92731b669376.png

9bc9731759ad869b4944f19800f063ff.png

842f516920e07ae17f8c26d99c646640.png

fc8c28094c460218fd0c544d83830ad9.png

aba0f516c309922ea692be8d81ed3e7a.png

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

676ff741d921f8d40d3851b890508791.png

watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=

e9611bba7adff97a61901b6107c4842c.png

8da84d405c238affc1d8f6bfc23df766.png

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

e73d520545e9dddc6c4288cd3e04de1e.png

7832b9be65ac73f4b7d31567d3ccd492.png

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

ba807710ae1d41f6e862f929b6e73f3a.png

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: ?????????, ??????, ???????

a376ef86bd1ba89e861c0e314916d949.png

d393a2db54035a77e359a5d1e55be93f.png

ed14df8884498c54ccd1caea1189c0bd.png

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;

数据库已更改。

76940e79c166f926528fbcc2838789c1.png

4a5817a13afce33c7db4692025f83f82.png

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

数据库装载完毕。

95e396f8f35b9b438e5f73e8ce135bc9.png实际情况无报错

4a0bc62f5fb9e118c47cb2b93c641e93.png

日志一样无报错

看来12c还是有不同

书原文

f294fc4183c4e5e9e9bf8c30f9ba3511.png

4413a4acc9401843a1177d3a8efcf2fa.png

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

看来以后要以这个表查询为主

查询后日志出现

014960d0fb3b9fdef1a0ac6db12ecef6.png

watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=

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

39cf39834054f9bbef740794675cb464.png刚才错误也返回

ada3e1af674234e0f131bc9d9395dad5.png

968310e93fe4544c1b2cec8382de12a6.png

0f73b4055f2ff0a1001e4771275aecb0.png

bac5d8dca2a3ebed9cc81d3f5391e7fd.png

b7dca656d116521ee3ad52e89a3f5705.png

0086dc1c9de93cc482354887899da97a.png12c无报错

2744c2a82a7d050e15c52092b886e585.png

907df5807f9defa94e3ad5fc221468ef.png

831c458fe60d86caefa2ac47c3c07422.png

747313c7a4a281c3ca8d7ebdebf338b0.png

f79c052ea3462f2e6e45dc86b695cbd4.png

e4f18ebedb735923a84f6894823bc073.png

feed3169c75334cd9948e50af0852192.png

91c0190f1804d809665cf859d5d009b7.png

2a6d9f150c85d434cf79e14e0c6416e5.png

d7e61161a58d66a75db16fe1109c60d0.png

91f9ab520b237a696d720aa5057f0d63.png

dd5fb1f44a77bb9842ab215a8f76255c.png

008e1f55c0cee919541dc212a18d8cf9.png

eda7e25b382ebe2c527f672941d3ba39.png

0b23f6836762b3514583c990f063f157.png

e9e5bc6f8e738f008bc4cc257e8918cf.png

cecac46ef1561e75df479c8f0ab1c60c.png

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信息。

879fb37d841e021c40e4b0d749ed2f86.png

01b87a5c7a10fe35610a2d202da4b03d.png

e6368fccca221fc33a68368f9606c86d.png

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

ed0717aaa8a40dde58d5473f3d3b3d69.png

a114f29646487a72441c0ecbc3809a43.png

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

9a028ae0c1ecd341fb9899cf30709ace.png

280413520a2c450451d5a22bfe6906fc.png

d782d33b0dce5914d84e8474cbcb2944.png

6145a497892bfb4903c0bf83a9b17f59.png

d14aef706c26d3b0c2b1bc1c0fcd52c7.png

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.

c19f404c75c5ec93ac920420b3b76ab5.png

1b32fe4ec6c092ca87084d474f6f1e01.png

50c1362a1eabbc425ec6938067d04cf6.png

74e36f304fd28fef54326323fc55e729.png

cbbf0ffaac76aa73b67bfc57cb859134.png

eab79ef09bac90fb10409ba00383b8f6.png

3ea5a122a4710cd1cc149a3a21082049.png

59607a8746c0a1851233488fb3d5910f.png

e6f99927442af4d92e9b88aaa54ddf8b.png

ed040c6700f60a62009f2f90f86a09c2.png

ad83a82c767024084f34f84e0703d523.png

e5b59647056430f5b8070362807974e9.png

d51e8de4704bc54907d8fdec7cde2072.png

e60db47ba88d89a53aa9164823bec424.png

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

bc6a4d31a90c9dd2fa4ef598c651df55.png

d4c0e408178f425181d8729508dcf81f.png

d0e5a6aa8f590df3caed31f4ddbdd0d7.png

newtest=

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.5.204)(PORT = 9200))

)

(CONNECT_DATA =

(SERVICE_NAME = newtest)

)

)

54a6480d9258cdc8717801490e437dde.png

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:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.5.204)(PORT = 9200))) (CONNECT_DATA = (SERVICE_NAME = newtest)))

OK (20 msec)

2c4e6f1938446acf40dcc7d23fe3cd88.png

fb00bd8edbb465c8914e299bfc2df1b1.png

C:\Users\Administrator>sqlplus sys/xxxxxxx@10.8.5.204:9200/newtest as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 5 15:21:48 2018

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

246f30d11cc32c85e8a9ff08ee424bdb.png

aae2c1c28d7738b5c6a06814baa37a56.png

80595f4f43c3bd049eed911f2c2d9208.png

1795e6bcc640e2d63867ca5c28c0beca.png

ad319ee3cb684d7f7ac012bd3a7e2ee8.png

SQL> show parameter service_name

NAME TYPE

VALUE

service_names string

newtest

C:\app\Administrator\virtual>lsnrctl status

LSNRCTL for 64-bit Windows: Version 12.2.0.1.0 - Production on 05-1月 -2018 15:2

3:22

Copyright (c) 1991, 2016, Oracle. All rights reserved.

正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

LISTENER 的 STATUS

别名 ORCL

版本 TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Produ

ction

启动日期 14-12月-2017 12:24:38

正常运行时间 22 天 2 小时 58 分 44 秒

跟踪级别 off

安全性 ON: Local OS Authentication

SNMP OFF

监听程序参数文件 C:\app\Administrator\virtual\product\12.2.0\dbhome_2\n

etwork\admin\listener.ora

监听程序日志文件 C:\app\Administrator\virtual\diag\tnslsnr\WIN-6NLPRCEF

FBK\orcl\alert\log.xml

监听端点概要...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WIN-6NLPRCEFFBK)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.\pipe\EXTPROC1521ipc)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.5.206)(PORT=1521)))

服务摘要..

服务 "24549d14bbeb417bab312bf19bc5259e" 包含 1 个实例。

实例 "newtest", 状态 READY, 包含此服务的 1 个处理程序...

服务 "CLRExtProc" 包含 1 个实例。

实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...

服务 "clonepdb_plug" 包含 1 个实例。

实例 "newtest", 状态 READY, 包含此服务的 1 个处理程序...

服务 "d4b2fcaac2b944cc8af5864ec7cb853c" 包含 1 个实例。

实例 "newtest", 状态 READY, 包含此服务的 1 个处理程序...

服务 "newtest" 包含 1 个实例。

实例 "newtest", 状态 READY, 包含此服务的 1 个处理程序...

服务 "newtestXDB" 包含 1 个实例。

实例 "newtest", 状态 READY, 包含此服务的 1 个处理程序...

服务 "pdbtest" 包含 1 个实例。

实例 "newtest", 状态 READY, 包含此服务的 1 个处理程序...

命令执行成功

3d60cd3e90d04c0d57b154e9bb390218.png

2fbbcc81ca2348bfdde92990694063e2.png

12da25daac389988c5b1bdfb5d4f82c0.png

77698f71970d5f2d8807329ccc97d8cb.png

69ccb5f75cfcdfb35ea094955cd0be44.png

04710d12a3116375f9cad627e4696018.png

226f24b984ad4a354df6304938a44fa4.png

41f6777c973792d37a6d639109f59aa3.png

4cc1b7411b776e4a64c6c23c854e8cec.png

0790c66c862214413d39e88cdff2019d.png

cd42e069b0202700c90f4a4c732ad329.png

8ac2e9ed8ee180233ef13c853981c952.png

7b9bed132e81d2950f9f6cb4af007b27.png

37c4d37e721f4b56fe5e1df9d0ae42b3.png

0d00a99077627ec67925035ef4be7eed.png

ad0e8b6122e556d0cd7b52febe100133.png

6104dfa009ff7d49ad0bc5e2117bbe2a.png

20936fb1456a59f33fa2af8300b1ec7f.png

SQL> alter database close;

alter database close

*

第 1 行出现错误:

ORA-01093: ALTER DATABASE CLOSE 仅允许在没有连接会话时使用

5f5e27e33b806798f53b0b4b29e6929a.png

SQL> alter database close;

数据库已更改。

SQL> alter database dismount;

数据库已更改。

SQL> shutdown;

ORA-01507: 未装载数据库

ORACLE 例程已经关闭。

4fef0528d6ff3afe0fb938dc1e8f004b.png

52db2a76ddb22653904680dc883a2289.png

1991445d6f862da15b49cf4a444aba4a.png

6c588230fe284f1eb67e22ade6be4535.png

1716b43f812e42ef10d431c1b97df063.png

a77c653da3cf5c82c8213a6a05069fbd.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值