Oracle Cheat Sheet



  1. Oracle Dba Cheat Sheet
  2. Oracle Cheat Sheet Pdf
  3. Oracle Sql Commands Cheat Sheet

1Oracle® Database SQL Language Quick Reference 11g Release 2 (11.2) E41085-04 January 2016. In Oracle 10g, GSD's sole purpose is to serve Oracle9i clients (such as SRVCTL, Database Configuration Assistant, and Oracle Enterprise Manager). Financially, this is a very positive benefit since one is not bound to buy new client licenses and hardware to support an Oracle 10g database.

Table of Contents

The query

will list the names of all non-system indexes. Also, fromhttp://technet.oracle.com/docs/products/oracle8i/doc_index.htm

System index views USER_INDEXES, ALL_INDEXES, and DBA_INDEXES indicatebitmap indexes by the word BITMAP appearing in the TYPE column. A bitmapindex cannot be declared as UNIQUE.

Must have system privileges to issue the query.

Must have system privileges to issue the query.

Getting the names of indexes for a table

See http://www.alberton.info/oracle_meta_info.html

In SQL*Plus, connect as SYSTEM/MANAGER@dbname. Then, issue the followingSQL:

For example:

Next, grant appropriate privileges to the new user:

In SQL*Plus, connect as user1/mypassword@dbname. Create tables, indexes,etc… They’ll be owned by the new user.

Create a second user, user2. (See above) Then, connect as user1, andissue this command:

Oracle Dba Cheat Sheet

Do this for all appropriate tables/indexes.

Now, if user2 logs in, he can access user1.table1, but he mustrefer to it as user1.table1. You can create a public synonym forthe table to make this easier. See below.

Log in as the table’s owner (user1, in this example), and issue this SQL:

Oracle Cheat Sheet

In a word: Don’t. Instead, grant the appropriate privileges on theappropriate tables to an unprivileged user.

Connect as SYSTEM/MANAGER, then:

Then, add the rollback segment name to the initXXX.ora file for theinstance.

As Oracle user:

If that fails, try killing the Oracle processes. Then, since Oracle usestwo of the “three evil sisters”, semaphores and shared memory, “ipcrm” theOracle-owned one after the “kill -9” and it should restart.

Dump:

When prompted with

accept the default (“U”), and enter the appropriate user name (i.e., theowner of the tables) when prompted.

Restore

Oracle Cheat Sheet Pdf

Drop all existing tables and indexes in same db first.

Oracle Sql Commands Cheat Sheet

May have to restore SYSTEM account’s password afterwards.

CTX_DDL must be declared

Oracle Cheat Sheet

If this error occurs:

then the user doesn’t have appropriate privileges. This seems to cure theproblem:

Error during stored procedure definition

If the above error occurs during definition of a stored procedure, then:

“Insufficient privilege” error

If you THEN get:

try:

Create the relevant tables in the schema, e.g.:

Create the PLUSTRACE role, etc.:

Grant the PLUSTRACE role to the user who owns the DB:

Can now run EXPLAIN PLAN (see Oracle docs) or autotrace.

  • “trace” says to run the statement(s) and print the plan(s), but avoiddisplaying any results.
  • “on” prints the plan(s) and the results.

Creating statistics for the cost-based optimizer

Cheat

Deleting those statistics:

Try waiting a minute or two.