This shows you the differences between two versions of the page.
bd:resurse:comenzi_utile [2019/03/06 12:36] fbratiloveanu |
bd:resurse:comenzi_utile [2019/04/25 10:33] (current) maria_luiza.serban |
||
---|---|---|---|
Line 1: | Line 1: | ||
==== Comenzi Utile ==== | ==== Comenzi Utile ==== | ||
+ | * Parole | ||
+ | |||
+ | <note warning> | ||
+ | **11g** | ||
+ | |||
+ | User: stud1 | ||
+ | |||
+ | Pass: student | ||
+ | |||
+ | **12c** | ||
+ | |||
+ | User: c##stud1 | ||
+ | |||
+ | Pass: student | ||
+ | |||
+ | </note> | ||
+ | * Formatare afisare | ||
+ | <code sql> | ||
+ | set lines 100 | ||
+ | set PAGES 100 | ||
+ | </code> | ||
* Lista cu tabelele la care are acces userul curent: | * Lista cu tabelele la care are acces userul curent: | ||
<code sql> select table_name from user_tables; </code> | <code sql> select table_name from user_tables; </code> | ||
Line 7: | Line 28: | ||
* Verificarea constrangerilor existente: | * Verificarea constrangerilor existente: | ||
<code sql> | <code sql> | ||
- | select * from user_constraints; | + | --Method 1 |
- | select constraint_name, constraint_type, table_name from user_constraints where REGEXP_LIKE(table_name, 'EMP|DEPT|SALGRADE'); | + | select * from user_constraints; |
- | select constraint_name, constraint_type, table_name from user_constraints where table_name = 'EMP'; | + | |
+ | --Method 2 | ||
+ | select constraint_name, constraint_type, table_name | ||
+ | from user_constraints | ||
+ | where table_name = 'EMP'; | ||
+ | |||
+ | --Method 3 | ||
+ | select constraint_name, constraint_type, table_name | ||
+ | from user_constraints | ||
+ | where REGEXP_LIKE(table_name, 'EMP|DEPT|SALGRADE'); | ||
+ | |||
+ | --Method 4 | ||
select * from user_cons_columns; | select * from user_cons_columns; | ||
</code> | </code> | ||
Line 34: | Line 65: | ||
AND a.table_name = 'EMP'; | AND a.table_name = 'EMP'; | ||
</code> | </code> | ||
- | * Formatare afisare | + | * Formatare data(mai multe informatii [[https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_commands_1029.htm#OLADM780|aici]]) |
- | <code sql> | + | <code sql> |
- | set lines 100 | + | -->verificare format |
- | set PAGES 100 | + | --a. Method 1 |
+ | define _DATE | ||
+ | --b. Method 2 | ||
+ | SELECT sysdate FROM dual; | ||
+ | |||
+ | -->modificare format | ||
+ | ALTER SESSION SET nls_date_format='DD-MON-YYYY'; | ||
</code> | </code> | ||
+ | |||
+ | * Verificare indecși | ||
+ | <code sql> | ||
+ | select index_name, table_name from user_indexes; | ||
+ | </code> | ||
+ | |||