database:oracle
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| database:oracle [2013/10/15 06:45] – [Commands] skipidar | database:oracle [2023/11/01 07:13] (current) – ↷ Page moved from business_process_management:camunda:database:oracle to database:oracle skipidar | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ==== Oracle ==== | ||
| + | === Installation === | ||
| + | The Installation for Windows is described [[http:// | ||
| + | |||
| + | ===== Syntax ===== | ||
| + | The syntax is listed [[http:// | ||
| + | |||
| + | ====Commands ==== | ||
| + | |||
| + | Requirenments: | ||
| + | - The environment variable should point to a tnsnames.ora: | ||
| + | |||
| + | |||
| + | == Ping the DB == | ||
| + | To ping the DB - do: | ||
| + | < | ||
| + | tnsping AVSP31DB02_faredb | ||
| + | </ | ||
| + | |||
| + | == Connect to the DB as passwordless system user " | ||
| + | If you have forgotten the DB password - you can connect to the Oracle DB as system user sysdba. | ||
| + | For that the following requirenments should be fulfilled: | ||
| + | |||
| + | - Set the environment variable **ORACLE_HOME**. This is the folder, which contains the " | ||
| + | - Add the **%ORACLE_HOME%** to the Path environment var as the first entry | ||
| + | |||
| + | Then Open a console and type: | ||
| + | |||
| + | < | ||
| + | Achtung: ORACLE_SID soll so gesetzt werden, wie sie in **tnsnames.ora** auf die die Variable **TNS_ADMIN** zeigt, mit präfix. \\ | ||
| + | Also z.B. **ANB13010_ivudb** wenn tnsnames.ora Eintrag so aussieht: | ||
| + | < | ||
| + | ANB13010_ivudb = | ||
| + | (DESCRIPTION = | ||
| + | (ADDRESS_LIST = | ||
| + | (ADDRESS = (PROTOCOL = TCP)(HOST = ANB13010)(PORT = 1521)) | ||
| + | ) | ||
| + | (CONNECT_DATA = (SID = ivudb)) | ||
| + | ) | ||
| + | </ | ||
| + | |||
| + | |||
| + | < | ||
| + | set ORACLE_SID=ANB13010_ivudb | ||
| + | sqlplus /nolog | ||
| + | SQL> connect / as sysdba | ||
| + | </ | ||
| + | |||
| + | To login to TNSNSNAMES key (here APCE12FARE01_faredb) use the following: | ||
| + | < | ||
| + | set ORACLE_SID=APCE12FARE01_faredb | ||
| + | sqlplus login/ | ||
| + | |||
| + | sqlplus login/ | ||
| + | </ | ||
| + | For details see: http:// | ||
| + | |||
| + | == Drop the Database == | ||
| + | To drop a DB do login as " | ||
| + | < | ||
| + | SQL> shutdown immediate; | ||
| + | oracle database closed | ||
| + | oracle database dismounted | ||
| + | oracle instance shutdown | ||
| + | SQL> startup restrict mount; | ||
| + | SQL> drop database; | ||
| + | |||
| + | Database dropped | ||
| + | SQL> exit | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==Login as == | ||
| + | < | ||
| + | sqplus user/ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | SELECT * FROM v$session; // Display logged in users. Session user are in the table **v$session**. CLIENT_INFO is the column, where userdefined locks may be saved. | ||
| + | </ | ||
| + | |||
| + | == Select field with the type " | ||
| + | < | ||
| + | SELECT * FROM test_schichtabrechnung WHERE SCHICHT_START > TO_TIMESTAMP (' | ||
| + | </ | ||
| + | |||
| + | == Show All Constraints == | ||
| + | |||
| + | To check all table constraints, | ||
| + | There you can see the dependent tables, lookup the data in this table, delete it and then delete the initial data. | ||
| + | < | ||
| + | select * from all_constraints ORDER BY CONSTRAINT_NAME DESC; | ||
| + | </ | ||
| + | |||
| + | |||
| + | == Modify Table == | ||
| + | < | ||
| + | # insert a column of type max 2 Number, 0 Numbers after decimal point | ||
| + | ALTER TABLE limit_state ADD EVALUATION_NORM_VALUE NUMBER(2,0) | ||
| + | </ | ||
| + | |||
| + | == Insert some Data == | ||
| + | < | ||
| + | insert into GERAETE_SAM | ||
| + | (" | ||
| + | values (' | ||
| + | |||
| + | |||
| + | insert into USERCARD | ||
| + | (" | ||
| + | values (' | ||
| + | |||
| + | insert into SHIFT_STATE (" | ||
| + | values (' | ||
| + | |||
| + | # update | ||
| + | update limit_state set EVALUATION_NORM_VALUE=6 WHERE EVALUATION_NORM_VALUE> | ||
| + | </ | ||
| + | |||
| + | == Modify DATE row == | ||
| + | < | ||
| + | UPDATE schichtabrechnung SET DATUM_ABRECHNUNG=TO_DATE(' | ||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | == Export/ Import Data == | ||
| + | |||
| + | Details are described here: http:// | ||
| + | |||
| + | If DATA_PUMP_DIR does nt exist yet - create it in oracle. | ||
| + | |||
| + | < | ||
| + | expdp system/ | ||
| + | impdp system/ | ||
| + | |||
| + | exp userId=cli/ | ||
| + | import using the newest dbutils | ||
| + | </ | ||
| + | |||
| + | |||
| + | or exporting of a single table | ||
| + | < | ||
| + | exp userid=cli/ | ||
| + | |||
| + | </ | ||
