C:\Users\Administrator>set ORACLE_SID=orcl
C:\Users\Administrator>rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 12 09:36:48 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1562659286)
RMAN>
SQL*Plus - %edition_name%在建立Oracle备份集,备份和还原时需要此工具。
运行以下指令sqlplus / as sysdba以验证SQL*Plus 是否已经安裝于Oracle 资料库伺服器上並且运行正常。
SQL*Plus运行于Oracle 19c的示例:
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 12 09:41:15 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
Oracle內部流程检查: 为使得Oracle实例执行流暢,请确保Oracle实例內部流程工作正常:
DBWO (Database Writer)
LGWR (Log Writer)
MMAN (Memory Manager Process)
PMON (Process Monitor)
PSPO (Process Spawner Process)
SMON (System Monitor)
CKPT (Checkpoint process (thread on Windows) that runs by default on Windows)
ARCO (Archive Process (or thread on Windows))
RECO (Distributed Recovery Background Process)
SQL> select name, description from v$bgprocess where PADDR <>'00';
NAME     DESCRIPTION
-----   ---------------------------------------
PMON     process cleanup
VKTM     Virtual Keeper of TiMe process
GEN0     generic0
DIAG     diagnosibility process
DBRM     DataBase Resource Manager
VKRM     Virtual sKeduler for Resource Manager
PSP0     process spawner 0
DIA0     diagnosibility process 0
MMAN     Memory Manager
DBW0     db writer process 0
TMON     Transport Monitor
ARC0     Archival Process 0
ARC1     Archival Process 1
ARC2     Archival Process 2
ARC3     Archival Process 3
LGWR     Redo etc.
CKPT     checkpoint
SMON     System Monitor Process
SMCO     Space Manager Process
RECO     distributed recovery
LREG     Listener Registration
CJQ0     Job Queue Coordinator
AQPC     AQ Process Coord
MMON     Manageability Monitor Process
MMNL     Manageability Monitor Process 2
Oracle资料库伺服器支持版本: 请确保%edition_name%支持以下Oracle资料库伺服器版本。
Oracle 19c
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 12 12:04:25 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
Oracle 12c
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 - Production on Mon May 26 15:33:44 2019
Version 12.1.0.1.0
Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - Production
Version 12.1.0.1.0
SQL>
系统标识符(SID): 通过下列方法查詢SID:
- SQL command
SQL > select instance from v$thread;
INSTANCE
--------------------------------------
Orcl
请注意: 显示的数据只是示例並可能与您的Oracle实例上显示的不同。
或者
- 应用文本编辑器(例如Notepad++)开启D:\oracle\admin\orcl\pfile路径下的init.ora文档,寻找下列句子。
###########################################
# Database Identification
###########################################
db_domain=""
db_name="orcl"
Oracle_home 路径:
Oracle 19c
通过下列SQL查詢方法获得Oracle_home 路径。Oracle 19c 的Oracle_home 路径是“D:\app\oracle\19.0.0\dbhome_1”。
- SQL 指令
SQL > SELECT file_spec FROM DBA_LIBRARIES WHERE library_name = 'DBMS_SUMADV_LIB';
FILE_SPEC
-----------------------------------------------
D:\app\oracle\19.0.0\dbhome_1\bin\oraqsmashr.dll
请注意:显示的数据只是示例並可能与您的Oracle实例上显示的不同。
或者
- 应用文本编辑器(例如Notepad++)开启D:\oracle\admin\orcl\pfile路径下的init.ora 文档以验证Oracle_home 路径。
###########################################
# File Configuration
###########################################
control_files=("D:\app\oracle\oradata\ORCL\control01.ctl", "D:\app\oracle\oradata\ORCL\control02.ctl")
###########################################
Oracle 12c
通过下列SQL查詢方法获得Oracle_home 路径。Oracle 12c的Oracle_home 路径是“D:\app\oracle\product\12.1.0\dbhome_1”。
!
请注意init.ora文档中的oracle_home 路径与通过SQL指令获得的路径必须一致。如果不一致,请联系Oracle资料库管理员寻求支持。
资料库状态
ARCHIVELOG模式
Java 安裝: Oracle资料库上必须安裝Java。 JServer JAVA Virtual Machine 和 Oracle Database Java Packages 是"VALID"。
SQL > select comp_name, status from dba_registry;
COMP_NAME                               STATUS
---------                               ------------
OWB                                                  VALID
Oracle Application Express               VALID
Oracle Enterprise Manager               VALID
OLAP Catalog                                   VALID
Spatial                                                VALID
Oracle Multimedia                                  VALID
Oracle XML Database                     VALID
Oracle Text                                         VALID
Oracle Expression Filter                 VALID
Oracle Rules Manager                     VALID
Oracle Workspace Manager              VALID
Oracle Database Catalog Views          VALID
Oracle Database Packages and Types    VALID
JServer JAVA Virtual Machine        VALID
Oracle XDK                                  VALID
Oracle Database Java Package          VALID
Oracle系统账户的JAVASYSPRIV权限: %edition_name%应用Oracle system 账户以连接Oracle资料库伺服器从而授权备份和还原过程。system 账户必须具有下列权限。
使用下列指令查詢账户是否具有JAVASYSPRIV认证:
SQL> select * from DBA_ROLE_PRIVS where upper(grantee)='SYSTEM';
GRANTEE   GRANTED_ROLE           ADM   DEF   COM
-------   ------------           ---   ---   ---
SYSTEM   JAVASYSPRIV             NO     YES   NO
SYSTEM   AQ_ADMINISTRATOR_ROLE   YES   YES   YES
如果未有认证,授予system账户javasyspriv认证:
SQL> grant javasyspriv to system;
Grant succeeded.
Oracle系统账户的SYSDBA 特权:
使用下列指令查詢system账户是否具有SYSDBA 特权:
SQL> select * from v$pwfile_users where sysdba='TRUE';
USERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM CON_ID
-------- ----- ----- ----- ----- ----- ----- ------
SYS       TRUE TRUE FALSE FALSE FALSE FALSE     0
SYSTEM   TRUE FALSE FALSE FALSE FALSE FALSE     1
如果未有认证,授予system账户sysdba特权:
Oracle 19c
SQL> grant sysdba to system container=ALL;
Grant succeeded
Oracle 12c
SQL> grant sysdba to system;
Grant succeeded
请确保开启TNS listener服务以允许连结到Oracle资料库伺服器。应用lsnrctl status指令查詢TNS listener服务是否正在运行。
如果TNS listener服务未有开启,应用lsnrctl start指令开启服务。
例如:Oracle 19c上正在运行TNS listener服务。
C:\Users\Administrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 14-OCT-2020 16:45:29
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias        LISTENER
Version      TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date   14-OCT-2020 11:11:04
Uptime       0 days 5 hr. 34 min. 27 sec
Trace Level   off
Security     ON: Local OS Authentication
SNMP         OFF
Listener Parameter File     D:\oracle\19.3.0\dbhome\network\admin\listener.ora
Listener Log File     D:\oracle\diag\tnslsnr\w12x-5-43\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora19c-w2k16)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=ora19c-w2k16)(PORT=5500))(Security=(my_wallet_directory=D:\ORACLE\admin\orcl\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclcXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdborcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
如果未有开启,应用下列指引开启TNS listener:
C:\Users\Administrator>lsnrctl start
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 21-OCT-2020 15:44:41
Copyright (c) 1991, 2019, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
本地主机是可解析的
应用ping 127.0.0.1指令验证Oracle资料库伺服器的本地主机IP 127.0.0.1 是否可解析,因为这将是%edition_name%用来连接Oracle实例的IP地址。
C:\Users\Administrator>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\Users\Administrator>
Oracle端口号码: 采用netstat 和tnsping指令验证真正的端口号码。
- NETSTAT
C:\Users\Administrator>netstat -a|more
Active Connections
Proto     Local Address     Foreign Address             State
TCP     0.0.0.0:135     w12x-5-43:0                 LISTENING
TCP     0.0.0.0:445     w12x-5-43:0            LISTENING
TCP     0.0.0.0:1521    w12x-5-43:0                 LISTENING
TCP     0.0.0.0:3389     w12x-5-43:0                 LISTENING
TCP     10.16.10.81:139     w12x-5-43:0                 LISTENING
TCP     10.16.10.81:1521     w12x-5-43:56851     ESTABLISHED
TCP     10.16.10.81:2030     w12x-5-43:0                 LISTENING
TCP     [::]:135         w12x-5-43:0                 LISTENING
TCP     [::]:445             w12x-5-43:0                 LISTENING
TCP     [::]:1521             w12x-5-43:0                 LISTENING
TCP     [::]:3389             w12x-5-43:0                 LISTENING
TCP     [fe80::4d71:5f81:58b0:552c%16]:2030     w12x-5-43:0     LISTENING
TCP     [fe80::713e:e2d4:8e82:5f77%17]:1521     w12x-5-43:56760     ESTABLISHED
TCP     [fe80::713e:e2d4:8e82:5f77%17]:2030     w12x-5-43:0     LISTENING
TCP     [fe80::713e:e2d4:8e82:5f77%17]:56760     w12x-5-43:1521     ESTABLISHED
请注意:显示的数据只是示例並可能与您的Oracle实例上显示的不同。
- TNSPING
C:\Users\Administrator>tnsping 127.0.0.1
TNS Ping Utility for 64-bit Windows: Version 19.0.0.0.0 - Production on 14-OCT-2020 16:54:27
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
D:\oracle\19.3.0\dbhome\network\admin\sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
OK (0 msec)
Windows 用户账号权限: Windows用户账号必须为下列安全组中的一员。
- ORA_DBA
- ORA_OraDB19Home1_SYSBACKUP
- ORA_OraDB19Home1_SYSDG
- ORA_OraDB19Home1_SYSKM
Oracle 资料库相关的Windows服务:请确保所有Oracle 资料库相关的服务都已开启。
- OracleJobScheduler$SID$
- OracleOraDB19Home1MTSRecoveryService
- OracleOraDB19Home1TNSListener
- OracleRemExecServiceV2
- OracleService$SID$
限制
- %edition_name% 不支持进阶OracleOracle Express版本以及Oracle XE。
- 不支持对在远程计算机上运行的Oracle 资料库进行备份和还原。
- %edition_name% 不支持进阶Oracle 资料库建立,例如: Clusterware or RAC (Real Application Clusters), ASM (Automatic Storage Management), Data Guard 等等。
- %edition_name% Oracle 资料库备份集支持对于一个Oracle实例的备份和还原。对于有多个Oracle实例建立的Oracle资料库伺服器,要求每个实例对应一个独立的备份集。
- 为还原一个完整Oracle 资料库实例,下列项目必须在备份来源中被选择:
- 一定要选择 Oracle 资料库伺服器。

-
当建立备份集时,全部的资料库,包括SYSAUX, SYSTEM, UNDOTBS1, USERS 以及除了“TEMP”之外其他相关应用程式资料库必须被选择。否则,如果没有这些资料库的备份,无法完成一个完整Oracle资料库实例还原。
请注意: 即使备份来源选择“TEMP”,此资料库也会在备份进程中被跳过。
最佳实践和建议
- Oracle资料库伺服器需要通过定期完整资料库(Tablespaces, Control & Init File, Archived Logs)备份进行保护,建议至少每星期完整备份一次。
- 当建立备份集时,全部的资料库,包括SYSAUX, SYSTEM, UNDOTBS1, USERS 以及除了“TEMP”之外其他相关应用程式资料库必须被选择。否则,如果没有这些资料库的备份,无法完成一个完整Oracle资料库实例还原。
- 应在系统活动较少时安排完整资料库备份或增量/差异资料库备份,从而实现最佳性能並最大程度減少对资料库伺服器性能的影响(例如: 排程为在周末运行)。
- 存档日志备份应该定期进行,备份频率取决于存档日志的往来数目。资料库的往来越多,存档日志备份应该越频繁(例如: 进行每日多次备份取代每日单次备份)。
- 为提供最大程度的数据保护和灵活还原选项,建议进行下列配置:
- 至少一个非本地或云储存位置。
- 至少一个本地储存位置以进行快速还原。
- 定期测试还原以确保备份设置且执行无误。进行还原测试也可以帮助鉴定潜在问题或还原计划的缺口。
不要尝试将测试简易化是非常重要的,因为测试成功的目的不是证明所有过程都是无误的。
通过测试可能会发现还原计划中的缺陷,鉴定这些缺陷是十分重要的。
- 还原原始文件选项是为进阶Oracle用户而制定,只有在熟知并理解Oracle资料库时方可使用,否则並不建议使用这种还原选项因为需要应用额外的Oracle技术进行手动还原。
请參考以下文章以获取更多相关资讯:
Oracle 19c
https://docs.oracle.com/en/database/oracle/oracle-database/19/bradv/index.html.
Oracle 12c
https://docs.oracle.com/database/121/BRADV/title.html.
设置备份集細节
栏位 |
描述 |
名称 |
这是备份集的名称。您可以建立一个有意义的名称。
|
备份集类型 |
备份集的类型(例如:Oracle 资料库伺服器备份)。
|
登录ID |
这是登录ID。默认登录ID 为system。
|
密码 |
这是用于登录的密码。
|
主机 |
数据不可被用户更改。
|
端口 |
这是连接到Oracle 伺服器的的端口。默认为1521。
|
SID |
这是Oracle SID.
|
建立备份集:
- 输入一个有意义的备份集名称。
- 选择备份集类型。
- 输入登录ID。
- 输入密码。
- 输入端口。
- 输入SID。
- 点击[下一页] 按钮继续。