概述
Recovery Manager (RMAN) command-line interface has been enhanced to:
• Run SQL as-is at the command line, no longer requiring the SQL command.
• Support SELECT statements.
• Support the DESCRIBE command on tables and views.
These enhancements provide better ease-of-use when running SQL in an RMAN session.
恢复管理器(RMAN)命令行界面已增强:
运行SQL as-is在命令行,不再需要SQL命令。
支持SELECT语句。
在表和视图上支持DESCRIBE命令。
这些增强在RMAN会话中运行SQL时提供了更好的易用性。
SQL Interface Improvements
You can now issue most SQL commands in RMAN without preceding the command with the SQL keyword. For a few commands that exist in both RMAN and SQL and have very different uses, you can specify the SQL keyword to eliminate ambiguity. You no longer need to enclose the SQL command in quotes, which greatly simplifies the syntax when the SQL command itself requires quotation marks. The SQL ALTER command replaces the RMAN command.
The new RMAN DESCRIBE command provides the functionality of the SQL*Plus DESCRIBE command.
现在,您可以在RMAN中发出大多数SQL命令,而无需使用SQL关键字。对于在RMAN和SQL中存在的一些命令,并且有非常不同的用途,您可以指定SQL关键字来消除歧义。您不再需要将SQL命令括在引号中,这大大简化了SQL命令本身需要引号的语法。SQL ALTER命令替代RMAN命令。
新的RMAN描述命令提供了SQL * Plus描述命令的功能。
具体 RMAN 可执行哪些SQL 命令 可参考:
http://docs.oracle.com/database/121/RCMRF/rcmsynta2018.htm#RCMRF90631
实验
1) 11g 版本 RMAN 命令行执行SQL 命令要SQL关键字
RMAN> ALTER SYSTEM SWITCH LOGFILE
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "database"
RMAN-01008: the bad identifier was: SYSTEM
RMAN-01007: at line 1 column 7 file: standard input
RMAN> SQL "ALTER SYSTEM SWITCH LOGFILE";
sql statement: ALTER SYSTEM SWITCH LOGFILE
2)12c 执行命令可以使用SQL 关键字,也可以不使用
--执行alter 命令
RMAN> SQL ALTER SYSTEM SWITCH LOGFILE;
using target database control file instead of recovery catalog
Statement processed
RMAN> ALTER SYSTEM SWITCH LOGFILE;
Statement processed
RMAN> ALTER TABLESPACE users ADD DATAFILE '/u01/app/oracle/oradata/cndba/users02.dbf' SIZE 1M AUTOEXTEND ON NEXT 10K MAXSIZE 2M;
Statement processed
--执行select 命令
RMAN> SELECT dbid FROM v$database;
DBID
----------
215559030
--执行create 命令
RMAN> CREATE DIRECTORY dest_dir AS '/backup';
Statement processed
参考链接:
http://docs.oracle.com/database/121/NEWFT/chapter12101.htm#NEWFT002
http://docs.oracle.com/database/121/BRADV/release_changes.htm#BRADV623
版权声明:本文为博主原创文章,未经博主允许不得转载。