CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle Utilities
Version 10.2
 
General
Executable

Purpose

adrci Automated Diagnostic Repository Command Interpreter
agtctl A multithreaded extproc agent is started, stopped, and configured by an agent control utility called agtctl, which works like lsnrctl. However, unlike lsnrctl, which reads a configuration file (listener.ora), agtctl takes configuration information from the command line and writes it to a control file.
amdu Undocumented
asmcmd ASM Command Line Utility
asmtool ASM utility to stamp a disk with a header
asmtoolg ASM utility to stamp a disk with a header
cfo Undocumented
clscfg Cluster Ready Services (CRS) tool can be used to delete a node from a RAC cluster and update the OCR
clsfmt Undocumented
cluvfy Cluster Verify (RAC)
CMADMIN Connection Manager Administration
CMCTL Connection Manager Control utility
CMGW Connection Manager Gateway
CMMIGR Connection Manager tool that can be used to migrate an 9i cman.ora file to 11g
CreateDep Likely stands for "Create Deployment" but appears to be undocumented
crsctl Clusterware Control
crssetup Clusterware Setup
csscan Database Character Set Scanner
ctxhx The Ultra Search crawler uses the Oracle Text AUTO_FILTER, ctxhx, for processing of binary files. These are non-text, non-HTML files such as PDF files, Microsoft Word files, and so on. For Ultra Search to use the AUTO_FILTER, the shared library path environment variable must contain the $ORACLE_HOME/ctx/lib path.
ctxkbtc The knowledge base is the information source that Oracle Text uses to perform theme analysis, such as theme indexing, processing ABOUT queries, and to document theme extraction with the CTX_DOC package. A knowledge base is supplied for English and French.

With the ctxkbtc compiler, you can:
  • Extend your knowledge base by compiling one or more thesauri with the Oracle Text knowledge base. The extended information can be application-specific terms and relationships. During theme analysis, the extended portion of the knowledge base overrides any terms and relationships in the knowledge base where there is overlap.
  • Create a new user-defined knowledge base by compiling one or more thesauri. In languages other than English and French, this feature can be used to create a language-specific knowledge base.
ctxlc The Lexical Compiler (ctxlc) is a command-line utility that enables creation of Chinese and Japanese lexicons (dictionaries). Such a lexicon may either be generated from a user-supplied word list or from the merging of a word list with the system lexicon for that language.
ctxload Used to import a thesaurus file into the Oracle Text thesaurus tables.
dbca Database Configuration Assistant
dbua Database Upgrade Assistant
dbv DataBase Verify
deploync.bat
dgmgrl Data Guard Manager
dropjava
dsml2ldif LDAP
e2eme
emagent Enterprise Manager Agent
emagtm  
emagtmc  
emdctl  
emlEClient  
emtgtctl2
exp Export
expdp DataPump Export
extjob
extjobo
extproc
hsalloci
hsdepxa
hsots  
imp Import
impdp DataPump Import
jssu  
kfod  
launch  
LCSSCAN  
ldapadd LDAP
ldapaddmt LDAP
ldapbind LDAP
ldapcompare LDAP
ldapdelete LDAP
ldapmoddn LDAP
ldapmodify LDAP
ldapmodifymt LDAP
ldapsearch LDAP
lmsgen  
loadpsp  
lsnodes  
LSNRCTL Listener Control
lxegen  
lxinst  
mkstore  
nid Tool for setting a New IDentifier for a database
nmcbufp  
nmccollector  
nmefwmi  
nmei  
nmeo  
nmesrvc  
nmesrvops  
nmetm  
nmo  
nmocat  
nmuct  
nmupm  
oclskd  
ocopy  
ocrcheck  
ocrconfig  
ocrdump  
ocssd  
oifcfg Oracle Interface Configuration. Intended for use with RAC clusters
OKDSTRY  
OKINIT  
OKLIST  
onsctl  
opmd  
orabase  
oracle  
OracleAdNetConnect  
OracleAdNetTest  
oradim Utility for configuring Windows services. Not present in any non-Windows installation
orakill Utility for killing Oracle sessions from the operating system command line
orapwd Tool for creating and managing password files
orastack  
oratclsh  
oravssw  
ott  
proc  
racgeut  
racgimon  
racgmain  
racgmdb  
rawutl  
RemoteExecService  
rman  
schema  
sclsspawn  
sqlldr SQL*Loader used to load files from the file system into the database and by External Tables
sqlplus Command line SQL*Plus user interface
sqlplusw Command line SQL*Plus user interface for Windows
tkprof  
TNSLSNR  
tnsping Ping connections via SQL*Net. Determines the fact that SQL*Net can see a host and service
uidrvci  
umu.bat User migration
unzip Unzip utility used by the Oracle installer
wrap Tool for encrypting PL/SQL source code prior to loading into the database
wrc  
xml  
xmlcg  
xmlwf  
xsl  
xvm  
zip Zip utility used by the Oracle installer 
 
DBV
dbv USERID=username/password
segment_id=<tablespace_name.segfile.segblock>
logfile=<logging_file_name_and_path>
feedback=<integer>
help=<Y/N>
parfile=<parameter_file_name_and_path>
/*
The following example shows a sample use of the command-line interface to this mode of DBVERIFY.

SEGMENT_ID specifies the segment to be verified. It is composed of the tablespace ID number (tsn), segment header file number (segfile), and segment header block number (segblock). These can be obtained by querying TABLESPACE_ID, HEADER_FILE, and HEADER_BLOCK from sys_user_segs.

*/


SELECT tablespace_id, header_file, header_block
FROM sys_user_segs
ORDER BY 1,2,3;

dbv USERID=uwclass/uwclass SEGMENT_ID=2.3.38451

DBVERIFY - Verification starting : SEGMENT_ID = 2.3.38451

DBVERIFY - Verification complete

Total Pages Examined         : 32
Total Pages Processed (Data) : 28
Total Pages Failing (Data)   : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index)  : 0
Total Pages Processed (Other): 3
Total Pages Processed (Seg)  : 1
Total Pages Failing (Seg)    : 0
Total Pages Empty            : 0
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Highest block SCN            : 30027821 (0.30027821)
 
NID
DBNEWID is a database utility that can change the internal database identifier (DBID) and the database name (DBNAME) for an operational database.

Prior to the introduction of the DBNEWID utility, you could manually create a copy of a database and give it a new database name (DBNAME) by re-creating the control file. However, you could not give the database a new identifier (DBID). The DBID is an internal, unique identifier for a database. Because Recovery Manager (RMAN) distinguishes databases by DBID, you could not register a seed database and a manually copied database together in the same RMAN repository. The DBNEWID utility solves this problem by allowing you to change any of the following:

* Only the DBID of a database
* Only the DBNAME of a database
* Both the DBNAME and DBID of a database

Changing the DBID of a database is a serious procedure. When the DBID of a database is changed, all previous backups and archived logs of the database become unusable. After you change the DBID, you must open the database with the RESETLOGS option, which re-creates the online redo logs and resets their sequence to 1 (see the Oracle9i Database Administrator's Guide). Consequently, you should make a backup of the whole database immediately after changing the DBID.

Changing the DBNAME without changing the DBID does not require you to open with the RESETLOGS option, so database backups and archived logs are not invalidated. However, changing the DBNAME does have consequences. You must change the DB_NAME initialization parameter after a database name change to reflect the new name. Also, you may have to re-create the Oracle password file. If you restore an old backup of the control file (before the name change), then you should use the initialization parameter file and password file from before the database name change.

Syntax:
Keyword Description Default
TARGET Username / Password None
DBNAME New database name None
LOGFILE Output log None
REVERT Revert failed change NO
SETNAME Set a new database name only NO
APPEND Append to output log NO
HELP Displays help messages NO
/*
Ensure that you have a recoverable whole database backup and ensure that the target database is mounted but not open, and that it was shut down consistently prior to mounting.
*/


SHUTDOWN IMMEDIATE
STARTUP MOUNT

/* Invoke the DBNEWID utility on the command line, specifying a valid user with the SYSDBA privilege.
*/


% nid TARGET=sys/oracle@test_db

/*
To change the database name in addition to the DBID, specify the DBNAME parameter.
This example changes the name to orabase:
*/


% nid TARGET=sys/oracle@test DBNAME=orabase

/*
The DBNEWID utility performs validations in the headers of the datafiles and control files before attempting I/O to the files. If validation is successful, then DBNEWID prompts you to confirm the operation (unless you specify a log file, in which case it does not prompt), changes the DBID for each datafile (including offline normal and read-only datafiles), and then exits. The database is left mounted but is not yet usable.
*/


DBNEWID: Release 10.2.0.1.0

(c) Copyright 2005 Oracle Corporation. All rights reserved.

Connected to database TEST_DB (DBID=3942195360)

Control Files in database:
/oracle/dbs/cf1.f
/oracle/dbs/cf2.f

Change database id of database SOLARIS? (Y/[N]) => y

Proceeding with operation
Datafile /oracle/dbs/tbs_01.f - changed
Datafile /oracle/dbs/tbs_02.f - changed
Datafile /oracle/dbs/tbs_11.f - changed
Datafile /oracle/dbs/tbs_12.f - changed
Datafile /oracle/dbs/tbs_21.f - changed

/*
New DBID for database TEST_DB is 3942196782.
All previous backups and archived redo logs for this database are unusable
Proceed to shutdown database and open with RESETLOGS option.
DBNEWID - Database changed.

If validation is not successful, then DBNEWID terminates and leaves the target database intact. You can open the database, fix the error, and then either resume the DBNEWID operation or continue using the database without changing its DBID.
After DBNEWID successfully changes the DBID, shut down the database
*/


SHUTDOWN IMMEDIATE

-- Mount the database

STARTUP MOUNT

-- Open the database in RESETLOGS mode and resume normal use

ALTER DATABASE OPEN RESETLOGS;

/*
Make a new database backup. Because you reset the online redo logs, the old backups and archived logs are no longer usable in the current incarnation of the database.
*/
/*
The following steps describe how to change the database name without changing the DBID.

1. Ensure that you have a recoverable whole database backup.
2. Ensure that the target database is mounted but not open, and that it was shut down consistently prior to mounting.
*/


SHUTDOWN IMMEDIATE
STARTUP MOUNT

/*
3. Invoke the utility on the command line, specifying a valid user with the SYSDBA privilege. You must specify both the DBNAME and SETNAME parameters. This example changes the name to orabase:
*/


% nid TARGET=SYS/oracle@test_db DBNAME=orabase SETNAME=YES

/*
DBNEWID performs validations in the headers of the control files (not the datafiles) before attempting I/O to the files. If validation is successful, then DBNEWID prompts for confirmation, changes the database name in the control files, and exits. After DBNEWID completes successfully, the database is left mounted but is not yet usable.
*/


DBNEWID: Release 10.2.0.1.0

(c) Copyright 2005 Oracle Corporation. All rights reserved.

Connected to database TEST_DB (DBID=3942196782)

Control Files in database:
/oracle/dbs/cf1.f
/oracle/dbs/cf2.f

Change database name of database TEST_DB to ORABASE? (Y/[N]) => Y

Proceeding with operation

Database name changed from TEST_DB to ORABASE - database needs to be
shutdown.
Modify parameter file and generate a new password file before restarting.

DBNEWID - Successfully changed database name

/*
If validation is not successful, then DBNEWID terminates and leaves the target database intact. You can open the database, fix the error, and then either resume the DBNEWID operation or continue using the database without changing the database name.
4. Shut down the database.
*/


SHUTDOWN IMMEDIATE

/*
5. Set the DB_NAME initialization parameter in the initialization parameter file to the new database name.
6. Create a new password file.
7. Start up the database and resume normal use.
*/


STARTUP
 
/*
To revert a stalled DBID change operation, run the DBNEWID utility again, specifying the REVERT keyword.
*/


% nid TARGET=SYS/oracle REVERT=YES LOGFILE=$HOME/nid.log
/*
Connects with operating system authentication and changes only the DBID:
*/


% nid TARGET=/

/*
Changing the DBID and Database Name

The following example connects as user SYS and changes the DBID and also changes the database name to test2:
*/


% nid TARGET=SYS/oracle@test_db DBNAME=orabase
 
ORAPWD

Password File Utility
orapwd file=<fname> password=<password> entries=<users> force=<Y|N> ignorecase=<Y|N> nosysdba=<Y|N>

Note: Password for SYS is mandatory, the Force parameter is optional
nosysdba is specifically for use with Audit Vault and Data Vault
orapwd file=pwdorabase.ora password="N0Way!" entries=3 ignorecase=n nosysdba=y

SELECT * FROM v$pwfile_users;
 
ORASTACK

Windows Modify Reserved Stack Size
orastack <executable> <stack_size>
orastack
-- read the comments from the above command

orastack
oracle.exe 500000
orastack tnslsnr.exe 500000
 
WRAP

Wrap a function

See also DBMS_UTILITY
wrap iname=input_file oname=output_file
SELECT ascii('D') FROM dual;
SELECT ascii(' ') FROM dual;

-- create as a text file c: emp\unwrapped.sql
CREATE OR REPLACE FUNCTION unwrapped (namein VARCHAR2)
RETURN NUMBER IS
 c  PLS_INTEGER := 0;
 j  PLS_INTEGER;
 l  PLS_INTEGER;
BEGIN
  l := LENGTH(namein);

  FOR i IN 1.. l LOOP
    c := c + ASCII(SUBSTR(namein, i, 1));
  END LOOP;
  RETURN c;
END unwrapped;
/

-- create as a text file c: emp\wrapped.sql
CREATE OR REPLACE FUNCTION wrapped (namein VARCHAR2)
RETURN NUMBER IS
 c  PLS_INTEGER := 0;
 j  PLS_INTEGER;
 l  PLS_INTEGER;
BEGIN
  l := LENGTH(namein);

  FOR i IN 1.. l LOOP
    c := c + ASCII(SUBSTR(namein, i, 1));
  END LOOP;
  RETURN c;
END wrapped;
/

wrap iname=c: emp\wrapped.sql oname=c: emp\output.sql

SQL> @c: emp\unwrapped.sql
SQL> @c: emp\output.sql

set pagesize 0

SELECT text
FROM user_source
WHERE name = 'UNWRAPPED'
ORDER BY line;

SELECT text
FROM user_source
WHERE name = 'WRAPPED'
ORDER BY line;
 
Related Topics
DBMS_DDL
Functions
Procedures
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [43 users online]    © 2010 psoug.org