How to check last checkpoints in the datafile headers

SQL> column file# format a10
SQL> column TO_CHAR format a60
SQL> column FILE_NAME format a30
SQL> set linesize 150
SQL> SELECT TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI:SS') FROM dual;
TO_CHAR(SYSDATE,'DD
-------------------
05/02/2016 09:22:48

SQL> SELECT FILE# file_nr, TO_CHAR(CHECKPOINT_TIME,'DD/MM/YYYY HH24:MI:SS') checkpoint_time, NAME file_name
 FROM v$datafile_header;

   FILE_NR CHECKPOINT_TIME     FILE_NAME
---------- ------------------- ------------------------------------------------------------
         1 05/02/2016 09:22:19 /u01/app/oracle/oradata/prim/system01.dbf
         2 05/02/2016 09:22:19 /u01/app/oracle/oradata/prim/sysaux01.dbf
         3 05/02/2016 09:22:19 /u01/app/oracle/oradata/prim/undotbs01.dbf
         4 05/02/2016 09:22:19 /u01/app/oracle/oradata/prim/users01.dbf
         5 05/02/2016 09:22:19 /u01/app/oracle/oradata/prim/example01.dbf


How to enable autotrace on

Description:-
SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report

solution:-
For execution AUTOTRACE the users needs to have the PLUSTRACE role, which does not
exist by default. PLUSTRACE role can be created using SYS user by executing
/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/plustrce.sql
[oracle@server1]$ sqlplus /  as sysdba
SQL> @/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/plustrce.sql
SQL>
SQL> drop role plustrace;
drop role plustrace
          *
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist


SQL> create role plustrace;

Role created.

SQL>
SQL> grant select on v_$sesstat to plustrace;

Grant succeeded.

SQL> grant select on v_$statname to plustrace;

Grant succeeded.

SQL> grant select on v_$mystat to plustrace;

Grant succeeded.

SQL> grant plustrace to dba with admin option;

Grant succeeded.

SQL>
SQL> set echo off
SQL> grant plustrace to appuser;

Grant succeeded.
SQL>conn appuser/appuser

SQL> create table abc (id number);

Table created.

SQL> insert into abc values (1);

1 row created.


Execution Plan
----------------------------------------------------------

--------------------------------------------------------------------------------
-

| Id  | Operation                | Name | Rows  | Bytes | Cost (%CPU)| Time
|

--------------------------------------------------------------------------------
-

|   0 | INSERT STATEMENT         |      |     1 |   100 |     1   (0)| 00:00:01
|

|   1 |  LOAD TABLE CONVENTIONAL | ABC  |       |       |            |
|

--------------------------------------------------------------------------------
-



Statistics
----------------------------------------------------------
        136  recursive calls
         58  db block gets
         32  consistent gets
          0  physical reads
       6400  redo size
        843  bytes sent via SQL*Net to client
        782  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          2  sorts (memory)
          0  sorts (disk)
          1  rows processed



Related Posts Plugin for WordPress, Blogger...