Skip to content

Instantly share code, notes, and snippets.

@julbrs
Last active December 13, 2019 15:49
Show Gist options
  • Save julbrs/9ad7bc2e791afc2af0fcde8395fdde94 to your computer and use it in GitHub Desktop.
Save julbrs/9ad7bc2e791afc2af0fcde8395fdde94 to your computer and use it in GitHub Desktop.
Oracle cheat sheet

Oracle DB

Here is some SQL query to create an user with default auth:

CREATE USER user IDENTIFIED BY pw DEFAULT TABLESPACE users;
GRANT CONNECT TO user;
GRANT RESOURCE TO user;
ALTER USER user QUOTA UNLIMITED ON users;
ALTER USER user quota unlimited on users;

Drop an user:

DROP USER user CASCADE;

Now how to export a DB schema(+data) to a file:

EXP user/pw grants=N owner=user file=export.dump

And to import back the DB schema from a file

imp userid=eyes/eyes commit=Y file=export.dump fromuser=toto touser=eyes

ORACLE 11G Disable Oracle's password expiry:

ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

TNS:

ORCL =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(Host = host)(Port = 1521))
   )
 (CONNECT_DATA =
   (SERVICE_NAME = ORCL)
 )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment