-- Copyright (c) Oracle Corporation 1995, 2002. All Rights Reserved. -- -- NAME -- plustrce.sql -- -- DESCRIPTION -- Creates a role with access to Dynamic Performance Tables -- for the SQL*Plus SET AUTOTRACE ... STATISTICS command. -- After this script has been run, each user requiring access to -- the AUTOTRACE feature should be granted the PLUSTRACE role by -- the DBA. -- -- USAGE -- sqlplus "sys/knl_test7 as sysdba" @plustrce -- -- Catalog.sql must have been run before this file is run. -- This file must be run while connected to a DBA schema.
以sysdba用户执行下列语句即可正常使用autotrace功能。
1 2 3 4 5 6 7 8
set echo on droprole plustrace; createrole plustrace; grantselecton v_$sesstat to plustrace; grantselecton v_$statname to plustrace; grantselecton v_$mystat to plustrace; grant plustrace to dba withadminoption; set echo off
SQLPLUS友善化输出
set linesize 200:设置行宽,表示行宽被设置为200的字符 column name format a40:设置列宽,设置name列为40个字符,a表示alphanumeric,字符的意思 set pagesize 20:设置页面记录,设置每20行为一列