oracle.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 05 Aug 2015 23:55:34 +0300
changeset 1729 22ffd80639c0
parent 1625 0fa6542d8c93
child 1905 fba288d59662
permissions -rw-r--r--
Make centered content design with adoption for mobile devices. Highlight TOC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1403
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
.. include:: HEADER.rst
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
==================
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Oracle database.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
==================
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
.. contents::
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Oracle database development environment.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
========================================
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
  http://en.wikipedia.org/wiki/Oracle_SQL_Developer
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
                Integrated development environment (IDE) for working with
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
                SQL/PLSql in Oracle databases.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  http://en.wikipedia.org/wiki/SQL*Plus
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
                An Oracle database client that can run SQL and PL/SQL commands
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
                and display their results.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  http://en.wikipedia.org/wiki/Oracle_Forms
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
                Is a software product for creating screens that interact with an
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
                Oracle database. It has an IDE including an object navigator,
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
                property sheet and code editor that uses PL/SQL.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  http://en.wikipedia.org/wiki/Oracle_JDeveloper
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
                JDeveloper is a freeware IDE supplied by Oracle Corporation. It
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
                offers features for development in Java, XML, SQL and PL/SQL,
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
                HTML, JavaScript, BPEL and PHP.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
  http://en.wikipedia.org/wiki/Oracle_Reports
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
                Oracle Reports is a tool for developing reports against data
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
                stored in an Oracle database.
8f86324134d6 Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
1494
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    30
Useful PL/SQL stub.
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    31
===================
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    32
::
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    33
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    34
  set serveroutput on;
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    35
  set autotrace on statistics;
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    36
  set timing on;
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    37
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    38
  declare
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    39
  begin
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    40
    null;
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    41
  end;
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    42
  /
f7e956de0cd7 Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1486
diff changeset
    43
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    44
Database info.
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    45
==============
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    46
1624
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    47
List of users::
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    48
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    49
  select distinct(OWNER) from ALL_TABLES;
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    50
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    51
List of current user owned tables::
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    52
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    53
  select * from USER_TABLES;
1624
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    54
  select TABLE_NAME from USER_TABLES;
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    55
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    56
List of tables by owner::
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    57
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    58
  select OWNER || '.' || TABLE_NAME from ALL_TABLES
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    59
    order by OWNER;
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    60
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    61
List of current user table sizes::
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    62
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    63
  select SEGMENT_NAME, SEGMENT_TYPE, sum(BYTES) from USER_EXTENTS
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    64
    group by SEGMENT_NAME, SEGMENT_TYPE order by sum(BYTES);
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    65
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    66
  select sum(BYTES) from USER_EXTENTS;
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    67
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    68
Tables indexes::
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    69
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    70
  select * from USER_INDEXES order by TABLE_NAME;
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    71
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    72
List of index sizes::
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    73
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    74
  select index_name, table_name, sum(user_extents.bytes) as bytes from user_indexes
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    75
    left outer join user_extents on user_extents.segment_name = table_name
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    76
    group by index_name, table_name
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    77
    order by table_name;
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    78
1624
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    79
List of tables without primary keys::
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    80
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    81
  select OWNER || '.' || TABLE_NAME from ALL_TABLES
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    82
    where TABLE_NAME not in (
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    83
      select distinct TABLE_NAME from ALL_CONSTRAINTS where CONSTRAINT_TYPE = 'P'
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    84
    ) and OWNER in ('USER1', 'USER2')
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    85
    order by OWNER, TABLE_NAME;
baf11017516f List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1623
diff changeset
    86
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    87
List of currenct user constraints::
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    88
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    89
  select * from USER_CONSTRAINTS;
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    90
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    91
List of tablespaces::
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    92
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    93
  select distinct TABLESPACE_NAME from USER_TABLES;
1462
27d4d6c15cb4 Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
    94
1622
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
    95
List of current user permissions::
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
    96
1623
4496f9e49b7b Reformat code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
    97
  select * from SESSION_PRIVS;
1622
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
    98
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
    99
List of user permissions to tables::
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
   100
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
   101
  select * from ALL_TAB_PRIVS where TABLE_SCHEMA not like '%SYS' and TABLE_SCHEMA not like 'SYS%';
dec1fd4222e8 List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1583
diff changeset
   102
1625
0fa6542d8c93 List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1624
diff changeset
   103
List of user privileges::
0fa6542d8c93 List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1624
diff changeset
   104
0fa6542d8c93 List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1624
diff changeset
   105
  select * from USER_SYS_PRIVS
0fa6542d8c93 List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1624
diff changeset
   106
  select * from USER_TAB_PRIVS
0fa6542d8c93 List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1624
diff changeset
   107
  select * from USER_ROLE_PRIVS
0fa6542d8c93 List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1624
diff changeset
   108
1483
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   109
Profiling.
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   110
==========
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   111
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   112
Timing info about last queries::
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   113
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   114
  select LAST_LOAD_TIME, ELAPSED_TIME, MODULE, SQL_TEXT elasped from v$sql
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   115
    order by LAST_LOAD_TIME desc
1475d464e8a8 Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   116
1486
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   117
Improved version of above code::
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   118
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   119
  column LAST_LOAD_TIME format a20;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   120
  column TIME format a20;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   121
  column MODULE format a10;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   122
  column SQL_TEXT format a60;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   123
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   124
  set autotrace off;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   125
  set timing off;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   126
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   127
  select * from (
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   128
    select LAST_LOAD_TIME, to_char(ELAPSED_TIME/1000, '999,999,999.000') || ' ms' as TIME, MODULE, SQL_TEXT from SYS."V_\$SQL"
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   129
      where SQL_TEXT like '%BATCH_BRANCHES%'
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   130
      order by LAST_LOAD_TIME desc
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   131
    ) where ROWNUM <= 5;
f3be7476145d Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1485
diff changeset
   132
1484
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   133
In SQL/Plus::
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   134
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   135
  SET TIMING ON;
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   136
  -- do stuff
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   137
  SET TIMING OFF;
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   138
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   139
or::
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   140
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   141
  set serveroutput on
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   142
  variable n number
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   143
  exec :n := dbms_utility.get_time;
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   144
  select ......
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   145
  exec dbms_output.put_line( (dbms_utility.get_time-:n)/100) || ' seconds....' );
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   146
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   147
See:
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   148
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   149
  http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2113.htm
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   150
                $SQL lists statistics on shared SQL area without the GROUP BY
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   151
                clause.
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   152
1485
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   153
Last table modification time.
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   154
=============================
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   155
::
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   156
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   157
  select max(scn_to_timestamp(ora_rowscn)) from TBL;
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   158
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   159
  select timestamp from all_tab_modifications where table_owner = 'OWNER';
752e99dbb016 Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1484
diff changeset
   160
  select timestamp from all_tab_modifications where table_name = 'TABLE';
1484
20964d8677d7 Profiling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1483
diff changeset
   161
1482
1a012d9fe613 List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
   162
List of Oracle Reserved Words.
1a012d9fe613 List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
   163
==============================
1a012d9fe613 List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
   164
1a012d9fe613 List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
   165
 * http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm
1496
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   166
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   167
Adjust date format.
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   168
===================
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   169
::
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   170
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   171
  column parameter format a32;
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   172
  column value format a32;
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   173
  select parameter, value from v$nls_parameters;
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   174
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   175
  alter session set NLS_DATE_FORMAT = 'yyyy-mm-dd HH:MI:SS';
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   176
  alter session set NLS_TIMESTAMP_FORMAT = 'MI:SS.FF6';
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   177
  alter session set NLS_TIME_FORMAT = 'HH24:MI:SS.FF6';
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   178
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   179
  select sysdate from dual;
7679a0100061 Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1495
diff changeset
   180
1569
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   181
Working with SQL/Plus.
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   182
======================
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   183
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   184
Show error details::
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   185
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   186
  show errors;
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   187
1583
46a6bc1e9f2a Dump how exactly field stored
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
   188
Dump how exactly field stored::
1569
650683205401 Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1496
diff changeset
   189
1583
46a6bc1e9f2a Dump how exactly field stored
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
   190
  select dump(date '2009-08-07') from dual;
46a6bc1e9f2a Dump how exactly field stored
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
   191