shell和sqlplus交互

[oracle@oracle ~]$ more oracle_connect.sh
#!/bin/bash
#表空间使用状态
sqlplus -S / as sysdba >connect_oracle.txt <
[oracle@oracle ~]$ more connect_oracle.txt

'INFORMATION_DATABAS
--------------------
information_database


BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     17
Next log sequence to archive   19
Current log sequence           19

'UNDO_TABLESPACE_INFORMATIO
---------------------------
undo_tablespace_information


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1

'DATAFILE_INFORMATIO
--------------------
datafile_information


     FILE# STATUS  CHECKPOINT_CHANGE# LAST_CHANGE#          M NAME
---------- ------- ------------------ ------------ ---------- --------------------------------------------------
         1 SYSTEM             1158884                     770 /u01/app/oracle/oradata/PROD/system01.dbf
         2 ONLINE             1158884                     610 /u01/app/oracle/oradata/PROD/sysaux01.dbf
         3 ONLINE             1158884                     105 /u01/app/oracle/oradata/PROD/undotbs01.dbf
         4 ONLINE             1158884                    6.25 /u01/app/oracle/oradata/PROD/users01.dbf
         5 ONLINE             1158884                 345.625 /u01/app/oracle/oradata/PROD/example01.dbf
         6 ONLINE              979501       979501         10 /u01/app/oranfs/lfn_nfs.dbf

6 rows selected.


'INDEX_AND_CONSTRAINTS_INFORMATION_ABOUT_USER_SCOT
--------------------------------------------------
index_and_constraints_information_about_user_scott


INDEX_NAME                     INDEX_TYPE                  TABLE_NAME                     TABLE_TYPE  STATUS   CONSTRAINT_NAME                C STATUS
------------------------------ --------------------------- ------------------------------ ----------- -------- ------------------------------ - --------
PK_EMP                         NORMAL                      EMP                            TABLE       VALID    FK_DEPTNO                      R ENABLED
PK_DEPT                        NORMAL                      DEPT                           TABLE       VALID    FK_DEPTNO                      R ENABLED
PK_EMP                         NORMAL                      EMP                            TABLE       VALID    SYS_C0011481                   C ENABLED
PK_DEPT                        NORMAL                      DEPT                           TABLE       VALID    SYS_C0011481                   C ENABLED
PK_EMP                         NORMAL                      EMP                            TABLE       VALID    PK_DEPT                        P ENABLED
PK_DEPT                        NORMAL                      DEPT                           TABLE       VALID    PK_DEPT                        P ENABLED
PK_EMP                         NORMAL                      EMP                            TABLE       VALID    PK_EMP                         P ENABLED
PK_DEPT                        NORMAL                      DEPT                           TABLE       VALID    PK_EMP                         P ENABLED

8 rows selected.


'DUMP_FILE_PAT
--------------
dump_file_path


TRACE_FILE
----------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/prod/PROD/trace/PROD_ora_6930.trc
/u01/app/oracle/diag/rdbms/prod/PROD/trace/PROD_ora_6715.trc

 

你可能感兴趣的:(shell和sqlplus交互)