Search This Blog

Wednesday, April 18, 2012

grant table privileges

DECLARE
BEGIN
FOR x in (SELECT owner, table_name FROM all_tables WHERE OWNER IN('user1'))
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || x.owner || '.' || x.table_name || ' TO user2';
EXECUTE IMMEDIATE 'GRANT INSERT ON ' || x.owner || '.' || x.table_name || ' TO user2';
EXECUTE IMMEDIATE 'GRANT UPDATE ON ' || x.owner || '.' || x.table_name || ' TO user2';
EXECUTE IMMEDIATE 'GRANT DELETE ON ' || x.owner || '.' || x.table_name || ' TO user2';
EXECUTE IMMEDIATE 'GRANT ALTER ON ' || x.owner || '.' || x.table_name || ' TO user2';
EXECUTE IMMEDIATE 'GRANT INDEX ON ' || x.owner || '.' || x.table_name || ' TO user2';
EXECUTE IMMEDIATE 'GRANT REFERENCES ON ' || x.owner || '.' || x.table_name || ' TO user2';

END LOOP;
END;

Tuesday, April 3, 2012

Parameters in impdp and not in expdp

PARTITION_OPTIONS
REMAP_DATAFILE
REMAP_DATAFILE
REMAP_SCHEMA
REMAP_TABLE
REMAP_TABLESPACE
REUSE_DATAFILES
SKIP_UNUSABLE_INDEXES
SQLFILE
STREAMS_CONFIGURATION
TABLE_EXISTS_ACTION
TARGET_EDITION
TRANSFORM
TRANSPORT_DATAFILES

Parameters in expdp and not in impdp

COMPRESSION
ENCRYPTION
ENCRYPTION_ALGORITHM
ENCRYPTION_MODE
ESTIMATE_ONLY
FILESIZE
REUSE_DUMPFILES
SAMPLE
ADD_FILE
FILESIZE

Monday, April 2, 2012

remove old files in a directory

find location -mtime +5 -exec rm {} \;

removes files which are older than 5 days.