Saturday, 19 November 2011

To Know the Database Current SETUP

sql>    select instance_name,host_name from v$instance;
sql>    select name from v$database;

sql>   CLEAR
SET HEAD ON
SET VERIFY OFF
SPOOL file
COL tspace form a25 Heading "Tablespace"
COL tot_ts_size form 99999999999999 Heading "Size (Mb)"
COL free_ts_size form 99999999999999 Heading "Free (Mb)"
COL ts_pct form 9999 Heading "% Free"
COL ts_pct1 form 9999 Heading "% Used"
BREAK on report
COMPUTE sum of free_ts_size on report
COMPUTE sum of tot_ts_size on report
SELECT                                                                             /* + RULE */
                  df.tablespace_name tspace, df.BYTES / (1024 * 1024) tot_ts_size,
                  SUM (fs.BYTES) / (1024 * 1024) free_ts_size,
                  NVL (ROUND (SUM (fs.BYTES) * 100 / df.BYTES), 1) ts_pct,
                  ROUND ((df.BYTES - SUM (fs.BYTES)) * 100 / df.BYTES) ts_pct1
           FROM dba_free_space fs,
                 (SELECT tablespace_name, SUM (BYTES) BYTES
                       FROM dba_data_files
                 GROUP BY tablespace_name) df
          WHERE fs.tablespace_name(+) = df.tablespace_name
GROUP BY df.tablespace_name, df.BYTES
UNION ALL
SELECT                                                                              /* + RULE */
                 df.tablespace_name tspace, fs.BYTES / (1024 * 1024) tot_ts_size,
                 SUM (df.bytes_free) / (1024 * 1024) free_ts_size,
                 NVL (ROUND ((SUM (fs.BYTES) - df.bytes_used) * 100 / fs.BYTES),
                           1
                            ) ts_pct,
                ROUND ((SUM (fs.BYTES) - df.bytes_free) * 100 / fs.BYTES) ts_pct1
        FROM dba_temp_files fs,
              (SELECT tablespace_name, bytes_free, bytes_used
                       FROM v$temp_space_header
              GROUP BY tablespace_name, bytes_free, bytes_used) df
        WHERE fs.tablespace_name(+) = df.tablespace_name
GROUP BY df.tablespace_name, fs.BYTES, df.bytes_free, df.bytes_used
ORDER BY 4 DESC
/
SPOOL off;

sql>    set linesize 500;
sql>    select instance_name,host_name from v$instance;

sql>    select value from NLS_DATABASE_PARAMETERS where parameter='NLS_CHARACTERSET';

sql>    select value from NLS_DATABASE_PARAMETERS where parameter='NLS_NCHAR_CHARACTERSET';

sql>    col member format a50;
sql>    select * from v$logfile;

sql>    archive log list;

sql>    col name format a50;
sql>    select * from v$dbfile;

sql>    select tablespace_name, extent_management from dba_tablespaces;

sql>    select tablespace_name, contents from dba_tablespaces;

sql>    select tablespace_name, sum(bytes)/1024/1024 mb from dba_temp_files group by tablespace_name;

sql>    select tablespace_name, sum(bytes_cached)/1024/1024 mb from v$temp_extent_pool group by tablespace_name;

sql>    set linesize 500;
sql>    show parameter background_dump_dest

sql>    col value format a50;
sql>    select name,value from v$parameter where value is not null;


No comments:

Post a Comment