Home » Infrastructure » Windows » How do I pass in double quotation argument from dos to rman? (11.2.0.4 windows 2012 r2 Data Center)
|
|
Re: How do I pass in double quotation argument from dos to rman? [message #671656 is a reply to message #671635] |
Wed, 12 September 2018 00:23   |
 |
juniordbanewbie
Messages: 250 Registered: April 2014
|
Senior Member |
|
|
Dear John,
you are right, but you are missing my point here.
in linux I can do the following:
[oracle@ol72-12102-ee ~]$ rman checksyntax @$HOME/dba/scripts/backup/list/list_database_backup/list_database_backup_by_completion_date/rman_list_database_backup_by_completion_date.txt '"to_date('"'"'2018-08-26 15:00:00'"'"','"'"'YYYY-MM-DD HH24:MI:SS'"'"')"' '"to_date('"'"'2018-08-27 15:00:00'"'"','"'"'YYYY-MM-DD HH24:MI:SS'"'"')"'
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Sep 12 13:11:09 2018
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
RMAN> SET ECHO ON
2>
3> LIST BACKUP OF DATABASE COMPLETED BETWEEN "to_date('2018-08-26 15:00:00','YYYY-MM-DD HH24:MI:SS')" AND "to_date('2018-08-27 15:00:00','YYYY-MM-DD HH24:MI:SS')";
4>
5> SET ECHO OFF
6>
7> EXIT
The cmdfile has no syntax errors
Recovery Manager complete.
to escape a quote within a single quote
https://stackoverflow.com/questions/1250079/how-to-escape-single-quotes-within-single-quoted-strings
Quote:
alias rxvt='urxvt -fg '"'"'#111111'"'"' -bg '"'"'#111111'"'"
# ^^^^^ ^^^^^ ^^^^^ ^^^^
# 12345 12345 12345 1234
Explanation of how '"'"' is interpreted as just ':
' End first quotation which uses single quotes.
" Start second quotation, using double-quotes.
' Quoted character.
" End second quotation, using double-quotes.
' Start third quotation, using single quotes.
do you notice that I passed in all the arguments before entering them inside rman?
but the same cannot be said for MS dos environment.
the whole purpose of having a dynamic rman script or sqlplus script is so that the dynamic script can be reused again on any platform. Based on my experience I have harder time doing dos scripting compare to shell scripting.
even the following url
Quote:
http://www.robvanderwoude.com/escapechars.php
doesn't help me much.
|
|
|
|
|
|
Re: How do I pass in double quotation argument from dos to rman? [message #671709 is a reply to message #671697] |
Sat, 15 September 2018 05:06   |
 |
juniordbanewbie
Messages: 250 Registered: April 2014
|
Senior Member |
|
|
Dear all,
the following is the wrong way to invoke date arguments in dos
C:>rman checksyntax @C:\rman_list_database_backup_by_completion_date.txt '"to_date('"'"'2018-08-26
15:00:00'"'"','"'"'YYYY-MM-DD HH24:MI:SS'"'"')"'
Argument Value Description
-----------------------------------------------------------------------------
target quoted-string connect-string for target database
catalog quoted-string connect-string for recovery catalog
nocatalog none if specified, then no recovery catalog
cmdfile quoted-string name of input command file
log quoted-string name of output message log file
trace quoted-string name of output debugging message log file
append none if specified, log is opened in append mode
debug optional-args activate debugging
msgno none show RMAN-nnnn prefix for all messages
send quoted-string send a command to the media manager
pipe string building block for pipe names
timeout integer number of seconds to wait for pipe input
checksyntax none check the command file for syntax errors
-----------------------------------------------------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00552: syntax error in command line arguments
RMAN-01006: error signaled during parse
RMAN-02001: unrecognized punctuation symbol "-"
Dear Michel,
here's the outcome
C:>(for %i in ("to_date('20180826 15:00
:00','YYYYMMDD HH24:MI:SS')" sysdate) do @echo %~i) | rman target / @C:\rman_list_database_backup_by_completion_date.txt
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Sep 15 17:25:19 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: KORCL (DBID=2228540098, not open)
RMAN> SET ECHO ON
2>
3> LIST BACKUP OF DATABASE COMPLETED BETWEEN "
Enter value for 1: to_date('20180826 15:00:00','YYYYMMDD HH24:MI:SS') " AND "
Enter value for 2: sysdate ";
4>
5> SET ECHO OFF
6>
7> EXIT
echo set on
thanks you providing the correct way of passing argument to rman in dos.
|
|
|
|
Goto Forum:
Current Time: Sat May 03 21:31:35 CDT 2025
|