Oracle Database Dump erstellen und wieder einlesen
altes Verfahren
export ORACLE_HOME=/oracle/oracle/product/92se64 export ORACLE_SID=DBNAME export PATH=$PATH:$ORACLE_HOME/bin exp username/password file=/var/tmp/dump full=yes ... imp username/password file=/var/tmp/dump
Hinweis: vor dem Import muss man alle Objekte im Schema droppen.
neues Verfahren
impdp username/password dumpfile=backup.dmp directory=expimp table_exists_action=REPLACE
Oracle SQLPlus Kommandos
export ORACLE_HOME=/oracle/oracle/product/92se64 export PATH=$PATH:$ORACLE_HOME/bin sqlplus username/password@DBNAME SQL*Plus: Release 9.2.0.7.0 - Production on Mon Apr 16 12:35:55 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Release 9.2.0.7.0 - 64bit Production JServer Release 9.2.0.7.0 - Production SQL> describe spaces; Name Null? Type ----------------------------------------- -------- ---------------------------- SPACEID NOT NULL NUMBER(19) SPACENAME VARCHAR2(255) SPACEKEY NOT NULL VARCHAR2(255) SPACEDESCID NUMBER(19) HOMEPAGE NUMBER(19) CREATOR VARCHAR2(255) CREATIONDATE DATE LASTMODIFIER VARCHAR2(255) LASTMODDATE DATE SQL> set linesize 200 SQL> set pagesize 200 SQL> column spacename format a80 SQL> spool output.txt SQL> select spacename, creationdate from spaces; SPACENAME CREATIONDATE -------------------------------------------------------------------------------- ------------------- World Cup 2006 2006-04-27 13:30:47 ... 159 rows selected. SQL> drop table space cascade constraints; Table dropped. SQL>
Oracle "show tables" Command
Das von MySQL bekannte "show tables" command gibt es in Oracle nicht. Das Äquivalent hierzu ist:
select table_name from user_tables;
SQL Script ausführen
Eine Script-Datei mit SQL-Anweisungen kann innerhalb SQLPlus mit dem "start"-Befehl (Abkürzung "@") ausgeführt werden:
sqlplus username/password@DBNAME SQL*Plus: Release 9.2.0.7.0 - Production on Mon Apr 16 12:35:55 2007 ... SQL> @ my_sql_commands.sql ...