Skip to content

Instantly share code, notes, and snippets.

View ajantiss's full-sized avatar
🐊

Laurent Meiller ajantiss

🐊
View GitHub Profile
@ajantiss
ajantiss / oracle_dump.sql
Created March 18, 2016 10:10
Export / Import dump in Oracle using expdb/impdb
--
-- EXPORT
--
-- Checkfolders to export :
select OWNER, DIRECTORY_NAME,DIRECTORY_PATH from DBA_DIRECTORIES order by OWNER, DIRECTORY_NAME;
-- If need new one :
CREATE DIRECTORY DP_DIR as '/backup/folder' ;
-- Create it also on OS then :
@ajantiss
ajantiss / oracle_drop_all_tables.sql
Last active March 18, 2016 10:03
Drop all tables of a schema
CREATE OR REPLACE PROCEDURE DROP_ALL_TABLES
AS
CURSOR cTables IS SELECT TABLE_NAME FROM USER_TABLES;
vTableName USER_TABLES.TABLE_NAME%TYPE;
CURSOR cSequences IS SELECT SEQUENCE_NAME from USER_SEQUENCES;
vSequenceName USER_SEQUENCES.SEQUENCE_NAME%TYPE;
begin
--drop tables
open cTables;
loop
@ajantiss
ajantiss / oracle_create_user.sql
Last active March 18, 2016 10:03
Create user Oracle 10g
define user_name = &1
define user_pwd = &2
-- Customize the default tablespace and temporary tablespace if necessary
define ts_default = users
define ts_temp = temp
set verify off
CREATE USER &&user_name