Académique Documents
Professionnel Documents
Culture Documents
1 of 6
http://software.clapper.org/cheat-sheets/oracle.html#if-database-is-hung-...
Table of Contents
Getting a list of indexes
Getting a cross-reference of
tables and their indexes
Determining the indexes on a
table
Getting the names of indexes
for a table
Determining the columns on
which an index is based:
Other useful metadata queries
Creating a user
Changing users password
Sharing tables between two users
Creating a public synonym for a
table
Granting DBA privileges to a user
Creating a rollback segment:
If database is hung shutting down
or starting up
Dumping and Restoring an Oracle
Database
Dump:
Restore
Oracle 9.2.0 Intermedia
Problems:
CTX_DDL must be declared
Error during stored procedure
definition
Insufficient privilege error
EXPLAIN PLAN and Autotrace
Managing statistics for the
cost-based optimizer
After bringing up database, cant
connect via SQL*Plus.
5/14/2015 9:20 PM
2 of 6
http://software.clapper.org/cheat-sheets/oracle.html#if-database-is-hung-...
SELECT aic.index_name,
aic.column_name,
aic.column_position,
aic.descend,
aic.table_owner,
CASE alc.constraint_type
WHEN 'U' THEN 'UNIQUE'
WHEN 'P' THEN 'PRIMARY KEY'
ELSE ''
END AS index_type
FROM all_ind_columns aic
LEFT JOIN all_constraints alc
ON aic.index_name = alc.constraint_name
AND aic.table_name = alc.table_name
AND aic.table_owner = alc.owner
WHERE aic.table_name = 'TEST2'
-- table name
--AND aic.table_owner = 'HR'
-- table owner
--AND aic.index_name = 'TEST2_FIELD5_IDX' -- index name
ORDER BY column_position;
Creating a user
In SQL*Plus, connect as SYSTEM/MANAGER@dbname. Then, issue the following
SQL:
For example:
5/14/2015 9:20 PM
http://software.clapper.org/cheat-sheets/oracle.html#if-database-is-hung-...
Create a second user, user2. (See above) Then, connect as user1, and
issue this command:
Then, add the rollback segment name to the initXXX.ora file for the
instance.
$ svrmgrl
Oracle8i Enterprise Edition Release 8.1.5.0.2 - Production
With the Partitioning and Java options
PL/SQL Release 8.1.5.0.0 - Production
SVRMGR>
SVRMGR>
SVRMGR>
SVRMGR>
connect internal
shutdown
startup force
^D
If that fails, try killing the Oracle processes. Then, since Oracle uses
two of the three evil sisters, semaphores and shared memory, ipcrm the
Oracle-owned one after the kill -9 and it should restart.
3 of 6
5/14/2015 9:20 PM
4 of 6
http://software.clapper.org/cheat-sheets/oracle.html#if-database-is-hung-...
accept the default (U), and enter the appropriate user name (i.e., the
owner of the tables) when prompted.
Restore
Drop all existing tables and indexes in same db first.
then the user doesnt have appropriate privileges. This seems to cure the
problem:
5/14/2015 9:20 PM
5 of 6
http://software.clapper.org/cheat-sheets/oracle.html#if-database-is-hung-...
try:
Grant the PLUSTRACE role to the user who owns the DB:
sqlplus user1/password@instance
SQL> set autotrace trace|on|off
SQL> <statement(s)>
5/14/2015 9:20 PM
http://software.clapper.org/cheat-sheets/oracle.html#if-database-is-hung-...
trace says to run the statement(s) and print the plan(s), but avoid
displaying any results.
on prints the plan(s) and the results.
6 of 6
5/14/2015 9:20 PM