请教各位师兄师姐:
    小弟,最近在做oracle数据库的冷备份和热备份,用的是proc的接口。用的是c++来实现,
但是现在遇到了一个技术问题,如何把在SQLPLUS里输入的命令,如shutdown immediate用c来实现,
但是在c/c++中只能嵌入SQL语句,而不能嵌入SQL*PLUS命令。
   遇到这个问题,项目进行不下去了,所以请师兄师姐指教。

解决方案 »

  1.   

    Start using SQL*Plus by executing the "sqlplus" command-line utility. Valid options are:
    userid/password@db -- Connection details
    /nolog             -- Do not login to Oracle. You will need to do it yourself.
    -s or -silent      -- start sqlplus in silent mode. Not recommended for beginners!
    @myscript          -- Start executing script called "myscript.sql"  
    Look at this example session: 
    sqlplus /nolog
    SQL> connect scott/tiger
    SQL> select * from tab;
    SQL> disconnect
    SQL> exit
    Please note that one must prepare the environment before starting sqlplus. Linux/ Unix example: 
     $ . oraenv
     ORACLE_SID = [orcl] ? orcl
     $ sqlplus scott/tiger
    Windows Example: 
     Click on "Start" -> "Run" and enter "cmd"
     C:> set ORACLE_SID=orcl
     C:> sqlplus scott/tiger
    or
     C:> sqlplus scott/tiger@orcl