oracle 11g OEM解锁scott 帐户 设置sqlplus linesize修改sqlplus的显示 将查询结果存入文件(spool)

Posted 霜序0.2℃

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 11g OEM解锁scott 帐户 设置sqlplus linesize修改sqlplus的显示 将查询结果存入文件(spool)相关的知识,希望对你有一定的参考价值。

解锁scott

进入oem首页

点击服务器,然后找到安全中的用户

找到scott

点入编辑,把锁定改成未锁定

成功解锁

用sqlplus 查询scott名下的表

select * from user_tables;

设置sqlplus linesize

由于列实在是太多了,没办法,只能凑合着看了


TABLE_NAME                     TABLESPACE_NAME                CLUSTER_NAME
------------------------------ ------------------------------ ------------------------------------------------------------
IOT_NAME                                                     STATUS     PCT_FREE   PCT_USED  INI_TRANS  MAX_TRANS INITIAL_EXTENT NEXT_EXTENT
------------------------------------------------------------ -------- ---------- ---------- ---------- ---------- -------------- -----------
MIN_EXTENTS MAX_EXTENTS PCT_INCREASE  FREELISTS FREELIST_GROUPS LOG B   NUM_ROWS     BLOCKS EMPTY_BLOCKS  AVG_SPACE  CHAIN_CNT AVG_ROW_LEN
----------- ----------- ------------ ---------- --------------- --- - ---------- ---------- ------------ ---------- ---------- -----------
AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE               INSTANCES            CACHE      TABLE_LO SAMPLE_SIZE LAST_ANALYZED  PAR
------------------------- ------------------- -------------------- -------------------- ---------- -------- ----------- -------------- ---
IOT_TYPE     T S NES BUFFER_ FLASH_C CELL_FL ROW_MOVE GLO USE DURATION                       SKIP_COR MON
------------ - - --- ------- ------- ------- -------- --- --- ------------------------------ -------- ---
CLUSTER_OWNER                                                DEPENDEN COMPRESS COMPRESS_FOR DRO REA SEG RESULT_
------------------------------------------------------------ -------- -------- ------------ --- --- --- -------
DEPT                           USERS
                                                             VALID            10                     1        255          65536     1048576
          1  2147483645                                         YES N
                                                       1                    1               N      ENABLED                             NO
             N N NO  DEFAULT DEFAULT DEFAULT DISABLED NO  NO                                 DISABLED YES
                                                             DISABLED DISABLED              NO  NO  YES DEFAULT

EMP                            USERS
                                                             VALID            10                     1        255          65536     1048576
          1  2147483645                                         YES N
                                                       1                    1               N      ENABLED                             NO
             N N NO  DEFAULT DEFAULT DEFAULT DISABLED NO  NO                                 DISABLED YES
                                                             DISABLED DISABLED              NO  NO  YES DEFAULT

BONUS                          USERS
                                                             VALID            10                     1        255
                                                                YES N
                                                       1                    1               N      ENABLED                             NO
             N N NO  DEFAULT DEFAULT DEFAULT DISABLED NO  NO                                 DISABLED YES
                                                             DISABLED DISABLED              NO  NO  NO  DEFAULT

SALGRADE                       USERS
                                                             VALID            10                     1        255          65536     1048576
          1  2147483645                                         YES N
                                                       1                    1               N      ENABLED                             NO
             N N NO  DEFAULT DEFAULT DEFAULT DISABLED NO  NO                                 DISABLED YES
                                                             DISABLED DISABLED              NO  NO  YES DEFAULT

永久设置

使用spool存入文件

不知道怎么用的可以看看这里:

spool简单使用

大致格式是这样

–不显示执行的sql语句
set echo off
–不显示XX rows selected的行
set feedback off
–不显示表头
set heading off
–不显示脚本运行结果
set termout off
–去掉脚本输出行尾部的空格
set trimspool on
–设置pagesize为零,不让oracle进行分页处理
set pagesize 0
–设置每行最大列数
set linesize 10000
–设置列之间的分隔符
set colsep ’ ’

SQL> set echo on
SQL> set feedback on
SQL> set heading on
SQL> set termout on
SQL> set trimspool on
SQL> set colsep '    '
SQL> spool D:\\a.txt
SQL> select * from user_tables;

TABLE_NAME                        TABLESPACE_NAME                   CLUSTER_NAME
------------------------------    ------------------------------    ------------------------------------------------------------
IOT_NAME                                                        STATUS        PCT_FREE      PCT_USED     INI_TRANS     MAX_TRANS
------------------------------------------------------------    --------    ----------    ----------    ----------    ----------
INITIAL_EXTENT    NEXT_EXTENT    MIN_EXTENTS    MAX_EXTENTS    PCT_INCREASE     FREELISTS    FREELIST_GROUPS    LOG    B      NUM_ROWS
--------------    -----------    -----------    -----------    ------------    ----------    ---------------    ---    -    ----------
    BLOCKS    EMPTY_BLOCKS     AVG_SPACE     CHAIN_CNT    AVG_ROW_LEN    AVG_SPACE_FREELIST_BLOCKS    NUM_FREELIST_BLOCKS
----------    ------------    ----------    ----------    -----------    -------------------------    -------------------
DEGREE                  INSTANCES               CACHE         TABLE_LO    SAMPLE_SIZE    LAST_ANALYZED     PAR    IOT_TYPE        T    S
--------------------    --------------------    ----------    --------    -----------    --------------    ---    ------------    -    -
NES    BUFFER_    FLASH_C    CELL_FL    ROW_MOVE    GLO    USE    DURATION                          SKIP_COR    MON
---    -------    -------    -------    --------    ---    ---    ------------------------------    --------    ---
CLUSTER_OWNER                                                   DEPENDEN    COMPRESS    COMPRESS_FOR    DRO    REA    SEG    RESULT_
------------------------------------------------------------    --------    --------    ------------    ---    ---    ---    -------
DEPT                              USERS
                                                                VALID               10                           1          255
         65536        1048576              1     2147483645                                                     YES    N

         1                       1                  N         ENABLED                                      NO
 N    N
NO     DEFAULT    DEFAULT    DEFAULT    DISABLED    NO     NO                                       DISABLED    YES
                                                                DISABLED    DISABLED                    NO     NO     YES    DEFAULT

EMP                               USERS
                                                                VALID               10                           1          255
         65536        1048576              1     2147483645                                                     YES    N

         1                       1                  N         ENABLED                                      NO
 N    N
NO     DEFAULT    DEFAULT    DEFAULT    DISABLED    NO     NO                                       DISABLED    YES
                                                                DISABLED    DISABLED                    NO     NO     YES    DEFAULT

BONUS                             USERS
                                                                VALID               10                           1          255
                                                                                                                YES    N

         1                       1                  N         ENABLED                                      NO
 N    N
NO     DEFAULT    DEFAULT    DEFAULT    DISABLED    NO     NO                                       DISABLED    YES
                                                                DISABLED    DISABLED                    NO     NO     NO     DEFAULT

SALGRADE                          USERS
                                                                VALID               10                           1          255
         65536        1048576              1     2147483645                                                     YES    N

         1                       1                  N         ENABLED                                      NO
 N    N
NO     DEFAULT    DEFAULT    DEFAULT    DISABLED    NO     NO                                       DISABLED    YES
                                                                DISABLED    DISABLED                    NO     NO     YES    DEFAULT


已选择4行。

已用时间:  00: 00: 00.02
SQL> spool off
SQL>

文件中查看

示例:有点乱的显示

TABLE_NAME                        TABLESPACE_NAME                   CLUSTER_NAME
   IOT_NAME                                                         STATUS        PCT_FREE      PCT_USED     INI_TRANS    MAX_TRANS     INITIAL_EXTENT    NEXT_EXTENT    MIN_EXTENTS    MAX_EXTENTS    PCT_INCREASE     FREELISTS    FREELIST_GROUPS    LOG    B      NUM_ROWS        BLOCKS    EMPTY_BLOCKS     AVG_SPACE     CHAIN_CNT    AVG_ROW_LEN    AVG_SPACE_FREELIST_BLOCKS    NUM_FREELIST_BLOCKS    DEGREE                  INSTANCES               CACHE         TABLE_LO    SAMPLE_SIZE    LAST_ANALYZED     PAR    IOT_TYPE        T    S    NES    BUFFER_    FLASH_C    CELL_FL    ROW_MOVE    GLO    USE    DURATION                          SKIP_COR    MON    CLUSTER_OWNER
 DEPENDEN    COMPRESS     COMPRESS_FOR    DRO    REA    SEG    RESULT_
------------------------------    ------------------------------    ------------------------------------------------------------    ------------------------------------------------------------    --------    ----------    ----------    ----------    ----------    --------------    -----------    -----------    -----------    ------------    ----------    ---------------    ---    -    ----------    ----------    ------------    ----------    ----------    -----------    -------------------------    -------------------    --------------------    --------------------    ----------    --------   -----------     --------------    ---    ------------    -    -    ---    -------    -------    -------    --------    ---    ---    ------------------------------    --------    ---    ------------------------------------------------------------    --------    --------    ------------    ---    ---    ---    -------
DEPT                              USERS
   VALID                10                           1           255             65536        1048576              1    2147483645                                                      YES    N
  N          ENABLED                                      NO                     N    N    NO     DEFAULT    DEFAULT   DEFAULT    DISABLED    NO     NO                                DISABLED    YES
 DISABLED    DISABLED                     NO     NO     YES    DEFAULT
EMP                               USERS
   VALID                10                           1           255             65536        1048576              1    2147483645                                                      YES    N
  N          ENABLED                                      NO                     N    N    NO     DEFAULT    DEFAULT   DEFAULT    DISABLED    NO     NO                                DISABLED    YES
 DISABLED    DISABLED                     NO     NO     YES    DEFAULT
BONUS                             USERS
   VALID                10                           1           255                                                   YES    N
  N          ENABLED                                      NO                     N    N    NO     DEFAULT    DEFAULT   DEFAULT    DISABLED    NO     NO                                DISABLED    YES
 DISABLED    DISABLED                     NO     NO     NO     DEFAULT
SALGRADE                          USERS
   VALID                10                           1           255             65536        1048576              1    2147483645                                                      YES    N
  N          ENABLED                                      NO                     N    N    NO     DEFAULT    DEFAULT   DEFAULT    DISABLED    NO     NO                                DISABLED    YES
 DISABLED    DISABLED                     NO     NO     YES    DEFAULT

已选择4行。

已用时间:  00: 00: 00.02

以上是关于oracle 11g OEM解锁scott 帐户 设置sqlplus linesize修改sqlplus的显示 将查询结果存入文件(spool)的主要内容,如果未能解决你的问题,请参考以下文章

visual studio 2013连接Oracle 11g

oracle 11g 安装和使用

oracle解锁oracle默认用户scott

在 oracle 19c 中解锁 SCOTT 用户

Oracle12c解锁scott测试用户

oracle 11g oem 无法打开