author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Thu, 12 Oct 2017 23:13:08 +0300 | |
changeset 2196 | 4709306e4ec8 |
parent 2194 | 60f74f8b5967 |
child 2216 | 303e4963ffc5 |
permissions | -rw-r--r-- |
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 |
|
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 |
Oracle database. |
8f86324134d6
Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
================== |
8f86324134d6
Oracle database development environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1625
diff
changeset
|
7 |
:local: |
1403
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 |
|
2194
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
30 |
Useful PL/SQL stubs |
1494
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 autotrace on statistics; |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
35 |
set timing on; |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
36 |
|
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
37 |
declare |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
38 |
begin |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
39 |
null; |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
40 |
end; |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
41 |
/ |
f7e956de0cd7
Useful PL/SQL stub.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1486
diff
changeset
|
42 |
|
2113 | 43 |
Using variables:: |
44 |
||
45 |
declare |
|
46 |
x number; |
|
47 |
begin |
|
48 |
select 1 into x from dual; |
|
49 |
end; |
|
50 |
/ |
|
51 |
||
2114 | 52 |
Enabling printing:: |
53 |
||
54 |
set serveroutput on; |
|
55 |
exec DBMS_OUTPUT.PUT_LINE('Hello'); |
|
56 |
exec DBMS_OUTPUT.DISABLE(); |
|
57 |
exec DBMS_OUTPUT.PUT_LINE('Silence'); |
|
58 |
exec DBMS_OUTPUT.ENABLE(); |
|
59 |
||
2194
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
60 |
Call procedure:: |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
61 |
|
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
62 |
create or replace procedure MY_PROC as |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
63 |
begin |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
64 |
null; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
65 |
end; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
66 |
/ |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
67 |
|
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
68 |
begin |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
69 |
MY_PROC; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
70 |
end; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
71 |
/ |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
72 |
|
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
73 |
Call function:: |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
74 |
|
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
75 |
create or replace function MY_FUN return number as |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
76 |
begin |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
77 |
return 42; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
78 |
end; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
79 |
/ |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
80 |
|
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
81 |
declare |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
82 |
x NUMBER; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
83 |
begin |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
84 |
ret := MY_FUN(); |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
85 |
end; |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
86 |
/ |
60f74f8b5967
Call procedure/function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2185
diff
changeset
|
87 |
|
1623 | 88 |
Database info. |
89 |
============== |
|
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
90 |
|
1624
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
91 |
List of users:: |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
92 |
|
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
93 |
select distinct(OWNER) from ALL_TABLES; |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
94 |
|
1623 | 95 |
List of current user owned tables:: |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
96 |
|
1623 | 97 |
select * from USER_TABLES; |
1624
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
98 |
select TABLE_NAME from USER_TABLES; |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
99 |
|
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
100 |
List of tables by owner:: |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
101 |
|
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
102 |
select OWNER || '.' || TABLE_NAME from ALL_TABLES |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
103 |
order by OWNER; |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
104 |
|
1623 | 105 |
List of current user table sizes:: |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
106 |
|
1623 | 107 |
select SEGMENT_NAME, SEGMENT_TYPE, sum(BYTES) from USER_EXTENTS |
108 |
group by SEGMENT_NAME, SEGMENT_TYPE order by sum(BYTES); |
|
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
109 |
|
1623 | 110 |
select sum(BYTES) from USER_EXTENTS; |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
111 |
|
2185
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
112 |
Table indexes restricted to user:: |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
113 |
|
1623 | 114 |
select * from USER_INDEXES order by TABLE_NAME; |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
115 |
|
2185
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
116 |
Table indexes available to user:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
117 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
118 |
select * from ALL_INDEXES order by TABLE_NAME; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
119 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
120 |
All table indexes:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
121 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
122 |
select * from DBA_INDEXES order by TABLE_NAME; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
123 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
124 |
View index columns:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
125 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
126 |
select * from DBA_IND_COLUMNS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
127 |
select * from ALL_IND_COLUMNS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
128 |
select * from USER_IND_COLUMNS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
129 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
130 |
Vie index expressions:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
131 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
132 |
select * from DBA_IND_EXPRESSIONS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
133 |
select * from ALL_IND_EXPRESSIONS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
134 |
select * from USER_IND_EXPRESSIONS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
135 |
|
1623 | 136 |
List of index sizes:: |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
137 |
|
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
138 |
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
|
139 |
left outer join user_extents on user_extents.segment_name = table_name |
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
140 |
group by index_name, table_name |
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
141 |
order by table_name; |
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
142 |
|
2185
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
143 |
View index statistics:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
144 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
145 |
select * from DBA_IND_STATISTICS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
146 |
select * from ALL_IND_STATISTICS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
147 |
select * from USER_IND_STATISTICS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
148 |
select * from INDEX_STATS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
149 |
|
1624
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
150 |
List of tables without primary keys:: |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
151 |
|
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
152 |
select OWNER || '.' || TABLE_NAME from ALL_TABLES |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
153 |
where TABLE_NAME not in ( |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
154 |
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
|
155 |
) and OWNER in ('USER1', 'USER2') |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
156 |
order by OWNER, TABLE_NAME; |
baf11017516f
List of tables by owner.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1623
diff
changeset
|
157 |
|
2185
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
158 |
List of current constraints limited to current user:: |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
159 |
|
1623 | 160 |
select * from USER_CONSTRAINTS; |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
161 |
|
2185
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
162 |
List of constraints available to user:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
163 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
164 |
select * from ALL_CONSTRAINTS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
165 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
166 |
List of all constraints:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
167 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
168 |
select * from DBA_CONSTRAINTS; |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
169 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
170 |
.. note:: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
171 |
``CONSTRAINT_TYPE``: |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
172 |
|
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
173 |
* ``C`` (check constraint on a table) |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
174 |
* ``P`` (primary key) |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
175 |
* ``U`` (unique key) |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
176 |
* ``R`` (referential integrity) |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
177 |
* ``V`` (with check option, on a view) |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
178 |
* ``O`` (with read only, on a view) |
f31a1ff8d8d9
Discover indexes and constraints.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2147
diff
changeset
|
179 |
|
1623 | 180 |
List of tablespaces:: |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
181 |
|
1623 | 182 |
select distinct TABLESPACE_NAME from USER_TABLES; |
1462
27d4d6c15cb4
Информация о таблицах в БД Oracle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1403
diff
changeset
|
183 |
|
2112 | 184 |
List user objects:: |
185 |
||
186 |
select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS |
|
187 |
order by OBJECT_TYPE, OBJECT_NAME; |
|
188 |
||
1622
dec1fd4222e8
List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1583
diff
changeset
|
189 |
List of current user permissions:: |
dec1fd4222e8
List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1583
diff
changeset
|
190 |
|
1623 | 191 |
select * from SESSION_PRIVS; |
1622
dec1fd4222e8
List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1583
diff
changeset
|
192 |
|
dec1fd4222e8
List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1583
diff
changeset
|
193 |
List of user permissions to tables:: |
dec1fd4222e8
List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1583
diff
changeset
|
194 |
|
dec1fd4222e8
List of current user permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1583
diff
changeset
|
195 |
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
|
196 |
|
1625
0fa6542d8c93
List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1624
diff
changeset
|
197 |
List of user privileges:: |
0fa6542d8c93
List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1624
diff
changeset
|
198 |
|
0fa6542d8c93
List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1624
diff
changeset
|
199 |
select * from USER_SYS_PRIVS |
0fa6542d8c93
List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1624
diff
changeset
|
200 |
select * from USER_TAB_PRIVS |
0fa6542d8c93
List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1624
diff
changeset
|
201 |
select * from USER_ROLE_PRIVS |
0fa6542d8c93
List of user privileges.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1624
diff
changeset
|
202 |
|
2146
274a3e6678ba
Dump how exactly field stored.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2137
diff
changeset
|
203 |
Dump how exactly field stored:: |
274a3e6678ba
Dump how exactly field stored.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2137
diff
changeset
|
204 |
|
274a3e6678ba
Dump how exactly field stored.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2137
diff
changeset
|
205 |
select dump(date '2009-08-07') from dual; |
274a3e6678ba
Dump how exactly field stored.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2137
diff
changeset
|
206 |
select dump(sysdate) from dual; |
274a3e6678ba
Dump how exactly field stored.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2137
diff
changeset
|
207 |
|
2111
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
208 |
Managing data files location |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
209 |
============================ |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
210 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
211 |
To find out where is data files located run as ``sysdba``:: |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
212 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
213 |
select * from dba_data_files; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
214 |
select * from dba_temp_files; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
215 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
216 |
Above files represent table spaces:: |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
217 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
218 |
select * from dba_tablespaces; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
219 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
220 |
Another information about installation:: |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
221 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
222 |
select * from v$controlfile; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
223 |
select * from v$tablespace; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
224 |
select * from v$database; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
225 |
show parameter control_files; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
226 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
227 |
Place for dumps:: |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
228 |
|
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
229 |
show parameter user_dump_dest; |
f780f1b08e12
Managing data files location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
230 |
|
2112 | 231 |
Installing express edition |
232 |
========================== |
|
233 |
||
234 |
Disable APEX port |
|
235 |
----------------- |
|
236 |
||
237 |
Find APEX port in usage:: |
|
238 |
||
239 |
select dbms_xdb.GetHttpPort, dbms_xdb.GetFtpPort from dual; |
|
240 |
||
241 |
Disable APEX lisener (to free useful 8080 port) from ``system``:: |
|
242 |
||
243 |
execute dbms_xdb.SetHttpPort(0); |
|
244 |
||
245 |
or move to another port:: |
|
246 |
||
247 |
execute dbms_xdb.SetHttpPort(8090); |
|
248 |
||
249 |
http://stackoverflow.com/questions/165105/how-to-disable-oracle-xe-component-which-is-listening-on-8080 |
|
250 |
How to disable Oracle XE component which is listening on 8080? |
|
251 |
http://daust.blogspot.co.il/2006/01/xe-changing-default-http-port.html |
|
252 |
XE: Changing the default http port. |
|
253 |
https://erikwramner.wordpress.com/2014/03/23/stop-oracle-xe-from-listening-on-port-8080/ |
|
254 |
Stop Oracle XE from listening on port 8080. |
|
255 |
||
2113 | 256 |
Creating user |
257 |
------------- |
|
258 |
||
259 |
From ``system`` account:: |
|
260 |
||
261 |
create user BOB identified by 123456; |
|
262 |
alter user BOB account unlock; |
|
263 |
alter user BOB default tablespace USERS; |
|
264 |
alter user BOB temporary tablespace TEMP; |
|
265 |
alter user BOB quota 100M on USERS; |
|
266 |
grant CREATE SESSION, ALTER SESSION to BOB; |
|
267 |
grant CREATE PROCEDURE, CREATE TRIGGER to BOB; |
|
268 |
grant CREATE TABLE, CREATE SEQUENCE, CREATE VIEW, CREATE SYNONYM to BOB; |
|
269 |
||
1483
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
270 |
Profiling. |
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
271 |
========== |
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
272 |
|
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
273 |
Timing info about last queries:: |
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
274 |
|
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
275 |
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
|
276 |
order by LAST_LOAD_TIME desc |
1475d464e8a8
Timing info about last queries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1482
diff
changeset
|
277 |
|
1486
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
278 |
Improved version of above code:: |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
279 |
|
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
280 |
column LAST_LOAD_TIME format a20; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
281 |
column TIME format a20; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
282 |
column MODULE format a10; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
283 |
column SQL_TEXT format a60; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
284 |
|
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
285 |
set autotrace off; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
286 |
set timing off; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
287 |
|
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
288 |
select * from ( |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
289 |
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
|
290 |
where SQL_TEXT like '%BATCH_BRANCHES%' |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
291 |
order by LAST_LOAD_TIME desc |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
292 |
) where ROWNUM <= 5; |
f3be7476145d
Improved version of code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1485
diff
changeset
|
293 |
|
1484 | 294 |
In SQL/Plus:: |
295 |
||
296 |
SET TIMING ON; |
|
297 |
-- do stuff |
|
298 |
SET TIMING OFF; |
|
299 |
||
300 |
or:: |
|
301 |
||
302 |
set serveroutput on |
|
303 |
variable n number |
|
304 |
exec :n := dbms_utility.get_time; |
|
305 |
select ...... |
|
306 |
exec dbms_output.put_line( (dbms_utility.get_time-:n)/100) || ' seconds....' ); |
|
307 |
||
2136
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
308 |
In SQL Developer you get execution time in result window. By default SQL |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
309 |
Developer limit output to 50 rows. To run full query select result window nat |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
310 |
press ``Ctrl+End``. |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
311 |
|
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
312 |
Alternatively you may wrap you query with (and optionally use hint to disable |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
313 |
optimizations??):: |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
314 |
|
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
315 |
select (*) from ( ... ORIGINAL QUERY ... ); |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
316 |
|
2137 | 317 |
Another option is:: |
318 |
||
319 |
delete plan_table; |
|
320 |
explain plan for ... SQL statement ...; |
|
321 |
select time from plan_table where id = 0; |
|
322 |
||
1484 | 323 |
See: |
324 |
||
2136
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
325 |
http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2113.htm |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
326 |
$SQL lists statistics on shared SQL area without the GROUP BY clause. |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
327 |
http://stackoverflow.com/questions/22198853/finding-execution-time-of-query-using-sql-developer |
3f34a66e6a2a
Finding Execution time of query using SQL Developer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2114
diff
changeset
|
328 |
Finding Execution time of query using SQL Developer. |
2137 | 329 |
http://stackoverflow.com/questions/3559189/oracle-query-execution-time |
330 |
Oracle query execution time. |
|
331 |
http://tkyte.blogspot.com/2007/04/when-explanation-doesn-sound-quite.html |
|
332 |
When the explanation doesn't sound quite right... |
|
1484 | 333 |
|
1485
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
334 |
Last table modification time. |
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
335 |
============================= |
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
336 |
:: |
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
337 |
|
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
338 |
select max(scn_to_timestamp(ora_rowscn)) from TBL; |
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
339 |
|
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
340 |
select timestamp from all_tab_modifications where table_owner = 'OWNER'; |
752e99dbb016
Last table modification time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1484
diff
changeset
|
341 |
select timestamp from all_tab_modifications where table_name = 'TABLE'; |
1484 | 342 |
|
1482
1a012d9fe613
List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1462
diff
changeset
|
343 |
List of Oracle Reserved Words. |
1a012d9fe613
List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1462
diff
changeset
|
344 |
============================== |
1a012d9fe613
List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1462
diff
changeset
|
345 |
|
1a012d9fe613
List of Oracle Reserved Words.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1462
diff
changeset
|
346 |
* 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
|
347 |
|
2147 | 348 |
Find time zone |
349 |
============== |
|
350 |
||
351 |
Set TZ data formt:: |
|
352 |
||
353 |
alter session set 'YYYY-MM-DD HH24:MI:SS.FF3 TZR'; |
|
354 |
||
355 |
For system TZ look to TZ in:: |
|
356 |
||
357 |
select SYSTIMESTAMP from dual; |
|
358 |
||
359 |
For session TZ look to TZ in:: |
|
360 |
||
361 |
select CURRENT_TIMESTAMP from dual; |
|
362 |
||
363 |
or directly in:: |
|
364 |
||
365 |
select SESSIONTIMEZONE from dual; |
|
366 |
||
367 |
You can adjust session TZ by:: |
|
368 |
||
369 |
alter session set TIME_ZONE ='+06:00'; |
|
370 |
||
371 |
which affect on ``CURRENT_DATE``, ``CURRENT_TIMESTAMP``, ``LOCALTIMESTAMP``. |
|
372 |
||
373 |
``DBTIMEZONE`` is set when database is created and can't be altered if the |
|
374 |
database contains a table with a ``TIMESTAMP WITH LOCAL TIME ZONE`` column and |
|
375 |
the column contains data:: |
|
376 |
||
377 |
select DBTIMEZONE from dual; |
|
378 |
||
379 |
Find time at timezone:: |
|
380 |
||
381 |
select SYSTIMESTAMP at time zone 'GMT' from dual; |
|
382 |
||
1496
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
383 |
Adjust date format. |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
384 |
=================== |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
385 |
:: |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
386 |
|
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
387 |
column parameter format a32; |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
388 |
column value format a32; |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
389 |
select parameter, value from v$nls_parameters; |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
390 |
|
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
391 |
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
|
392 |
alter session set NLS_TIMESTAMP_FORMAT = 'MI:SS.FF6'; |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
393 |
alter session set NLS_TIME_FORMAT = 'HH24:MI:SS.FF6'; |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
394 |
|
2147 | 395 |
alter session set TIME_ZONE = '+06:00'; |
396 |
||
1496
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
397 |
select sysdate from dual; |
7679a0100061
Adjust date format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1495
diff
changeset
|
398 |
|
1569
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
399 |
Working with SQL/Plus. |
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
400 |
====================== |
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
401 |
|
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
402 |
Show error details:: |
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
403 |
|
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
404 |
show errors; |
650683205401
Working with SQL/Plus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1496
diff
changeset
|
405 |