d-h-n.de
Blog about Oracle, Linux..

Flashback

April 28th, 2008 . by admin

-the flash recovery area can be a single directory, an entire file system or an AMS disk group
-a flash back recovery area can shared by more than one database
-flashback revovery area can contains:
.Control files
.Archived log files
.Flashback logs
.Control file and SPFILE autobackups
.Data file copies
.When flash recovery are configured, parameter LOG_ARCHIVE_DEST_10 is automatically set to the flash recovery area location.

Setup Flash Recovery Area with dynamic parameters:
-DB_RECOVERY_FILE_DEST_SIZE
-DB_RECOVERY_FILE_DEST

SQL> alter system set db_recovery_file_dest_size = 8g scope=both;

note: all instances in RAC must have the same
-DB_RECOVERY_FILE_DEST_SIZE
- DB_RECOVERY_FILE_DEST
Flash recovery area should be large enough to hold a copy of all datafiles, all incremental backups, online redo logs, control files and control file autobackups

Flash Recovery Area Management
-File no longer needed are deleted, a message is written to alert log
-when recovery area used space over 85%, a warning is issued
-when recovery area used space over 97%, a critical message is issued
-Message can be viewed per DBA_OUTSTANDING_ALERTS

-Infos about flash recovery: View V$RECOVERY_FILE_DEST

SQL> select name, space_limit_max_size, space_used_used, space_reclaimable, obsolete
  from v$recovery_file_dest;


-Config Flasback Database

SQL> shutdown immediate;
  SQL> startup mount exclusive;
  SQL> alter system set db:flashback_retention_target=60 scope=both; --60 min
  SQL> alter database flashback on;
  SQL> alter database open;
  SQL> select flashback_on from v$database; --to see, db flashback?
  ...and off!
SQL> alter database flashback off;

Flask back database (reset db back to time)

SQL> shutdown immediate;
SQL> startup mount exclusive;
SQL> flashback database to timestamp(sysdate -(1/48)); --back 30min
SQL> alter database open resetlogs;

Monitoring flashback database
V$FLASHBACK_DATABASE_LOG
V$FLASHBACK_DATABASE_STAT
see the actual size of flashback log

Excluding tablespace from flashback database
Excluding a tablespace NOT flashback!

SQL>aler tablespace abc flashback off;

Retrieving Dropped Tables from Recycle Bin

SQL> flashback table order_items to before drop;

Flashback and rename a table

SQL> flashback table order_items to before drop rename to order_items_old_version;

Recycle Bin
Views
USER_RECYCLEBIN
RECYCLEBIN
DBA_RECYLCEBIN

Show RECYCLEBIN

SQL> show RECYCLEBIN

Empty Recylce Bin

SQL> purge table users2 user gary;
--remove all of gary's objects from recyle bin for users2 tablespace

SQL> purge user_recylebin;
-- empty all object of the current user

Bypass the Recycle Bin

SQL> drop table abc purge;
  --object go not to recycle bin
SQL> drop user..cascade; --all objects are purged
  -drop tablespace..including contents 

-Only non-SYSTEM locally managed tablespace can have a recyle bin
-Table using Fine Grained Auditing, Virtual Private Database cannot reside in a recyle bin

Flashback Query
-Flashback Version Query: retrieves all versions of all rows in a table between 2 times stamp or SCNs
-Flashback Transaction Query: provide a diff. point of view by retrieving all rows affected by transaction
-View FLASHBACK_TRANSACTION_QUERY contains transaction infos. for all tables involved in a transaction
SELECT..FROM..VERSION BETWEEN
{scn | timestamp expr | MINVALUE AND expr | MAXVALUE}
 

Flashback Table
-allow to recover one or more tables to a spec. point in time
exm:

SQL> alter table hr.employees enable row movement;
  SQL> alter table hr.departments enable row movement;
  SQL> select * from hr.departments where department_name = 'IT';
  SQL> flashback table hr.employees, hr.departments
  to timestamp  systimestamp - interval '15'minute;
  SQL> select * from hr.departments where department_name = 'IT';


SCN and Timestamp Mapping

-convert SCN to Timestamp: SCN_TO_TIMESTAMP
-convert Timestamp to SCN:TIMESTAMP_TO_SCN
SQL> select timestamp_to_scn(systimestamp) from dual;
(compare with CURRENT_SCN in V$DATABASE)


Flashback Privileges

-Flashback database: SYSDBA
-Flashback table: FLASHBACK TABLE privilege and object privilege
-Flashback Version Query: FLASHBACK TABLE privilege and object privilege
-Flashback Transaction Query: SELECT ANY TRANSACTION
-Flashback Drop: Object privileges
 

Block change tracking
-Enable:

SQL> alter database enable block change tracking;

-When using OMF, Block change tracking file are auto. named and placed in the directory spec. by DB_CREATE_FILE_DEST
-When NOT using OMF block change tracking file must be defined

SQL> alter database enable block change tracking
   using file 'u01/oradata/changetracking/chg01.dbf';

-and turn off:

SQL> alter database disable block change tracking;

-View V$BLOCK_CHANGE_TRACKING
  


Scheduler

April 28th, 2008 . by admin

Scheduler

-New: DBMS_SCHEDULER
-Old: DBMS_JOB can only access PL/SQL block, stored program
-DBMS_SCHEDULER can OS executables
 

Scheduler concept
-Program: beschreiben das Program, das ausgeführt werden soll
-Schedule: specify when and how often a job excuted
-Job: componiert beiden: Program and Schedule -> JOB!
-Job class: define a group of jobs with same characteristics and common resource consummer group
-Window and window group: window represents an interval with defined start and end time.
Window group is a list of windows
 

DBMS_SCHEDULER.STOP
DBMS_SCHEDULER.RUN_JOB
DBMS_SCHEDULER.STOP_JOB
DBMS_SCHEDULER.ENABLE
DBMS_SCHEDULER.DISABLE
DBMS_SCHEDULER.DROP_JOB
DBMS_SCHEDULER.SET_ATTRIBUTE(name, attribute, value)
DBMS_SCHEDULER.PURGE_LOG
 

Privileges for Scheduler
-ANY privileges: ANY JOB; ANY PROGRAM; ANY CLASS
-MANAGER_SCHEDULER: privileges to manage job classes, window, window groups
-SCHEDUER_ADMIN includes CRREATE JOB; CREATE ANY JOB; EXECUTE ANY PROGRAM..,MANAGER_SCHEDULER

Views (*= DBA, ALL, or USER)
*_SCHEDULER_JOBS
*_SCHEDULER_JOB_ARGS
*_SCHEDULER_JOB_CLASSES
*_SCHEDULER_JOB_LOG
*_SCHEDULER_JOB_RUN_DETAILS
 

*_SCHEDULER_PROGRAMS
*_SCHEDULER_PROGRAM_ARGS

*_SCHEDULER_RUNNING_JOBS

*_SCHEDULER_SCHEDULES

*_SCHEDULER_WINDOWS
*_SCHEDULER_WINDOW_DETAILS
*_SCHEDULER_WINDOW_GROUPS
*_SCHEDULER_WINDOW_LOG
*_SCHEDULER_WINDOW_MEMBERS
 

Link: http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10739/scheduse.htm


ASM

April 28th, 2008 . by admin

What is ASM:

  • is a cluster file system, a volumme manager, a spec. environment for Oracle database
  • can using on standalone as RAC to encapsulating a file system
  • one ASM can share for more than one DB
  • works concert with OMF
  • make disk management easier
  • enhance the performance of database by automatically the I/O load across all availabe hardware
  • divides datafile into extents and divides the extents among all disks in the diskgroup
  • Automatic rebalancing is the feature: neue Verteilung der datafiles bei Einfügen new disks
  • more than one database may allocate files from the same ASM disk group
  • a ASM file is always spread over all ASM disks
  • a ASM disk belongs to only one ASM disk group
  • ASM disks are partitioned in units of 1MB each
  • 2 new background process support ASM: RBAL und ORBx
  • RBAL: coordinates the disk activity for disk groups
  • ORBn (n from 0..9) performs the actual extent movement between disks in the disk groups
  • OSMB: communication zwischen DB und ASM instance
  • RBAL: perform open and close of disks
  • Startup default is STARTUP MOUNT
  • ASM Instance has no controlfile
  • Parameter INSTANCE_TYPE=ASM. ASM Initalization Parameter
  • Parameter DB_UNIQUE_NAME=+ASM. ist der Name von ASM Instance
  • Parameter ASM_DISKSTRING=’/dev/raw/*’
  • Coarse striping: spreads files in unit of 1MB each across all disks.
  • Good for OLTP, high degree of concurrent IO requests
  • Fine striping: spreads file in unit of 128KB. Good for Datawarehouse, with low concurrency, but max. response time

ASM Parameters

INSTANCE_TYPE
For ASM instance: INSTANCE_TYPE=ASM
For database INSTANCE_TYPE=RDBMS

DB_UNIQUE_NAME
For ASM instance: DB_UNIQUE_NAME=*ASM
For database INSTANCE_TYPE=dbname

ASM_POWER_LIMIT
controls how fast rebalance opreations occurs. Rang from 1 to 11. Default 1
To change the power:
SQL> alter diskgroup data1 rebalance power 8;
To view the power:
SQL> select group_number, operation, state, power from v$asm_operation;

ASM_DISKSTRING
spec one or more strinfs, OS dependent, to limit the disk devices that can be used to create disk groups. If this value is NULL, all disks visible to ASM instance are potential cadidates for creating groups.
-To see ASM_DISKSTRING,
SQL> select name, type, value from v$parameter where name = ‘asm_diskstring’;

ASM_DISKGROUPS
spec. a list containing the names of disk groups to be automatically mounted by ASM instance startup. If empty, anny existing disk group can be manually mounted
see V$ASM_DISKGROUP
-LARGE_POOL_SIZE: >= 8MB
using in both regular and ASM. at least 8MB

ASM Filenames
-Fully Qualified Names
+group/dbname/file type/tag.file.incarnation

-Nummeric Names
+group.filenummer.incarnation

-Alias Name
-Alias with Templates Names
-Incomplete Names
-Incomplete Names with Template

-Failure Group
.is one or more disks within a disk group

ASM Views
-V$ASM_ALIAS
-V$ASM_ATTRIBUTE
-V$ASM_CLIENT
-V$ASM_DISK
-V$ASM_DISK_IOSTAT
-V$ASM_DISK_STAT
-V$ASM_DISKGROUP_STAT
-V$ASM_FILE
–V$ASM_OPERATION
-V$ASM_TEMPLATE

ASM and Windows
-disks must be defined as basic
-using disk management (diskmgmt.msc) or diskpart
-for every disk: create an EXTENDED partition that fills entire disk
-create a LOGICAL partition on the new partition
-do not format the partition
-do not assigned drive letter
-Using Disk Management to remove the unneeded drive letters
-Using asmtoolg, or asmtool to label the partitions for Oracle

ASM Redundancy and Failure Group
-when not use external redundancy, ASM provides its own internal redundancy mechanism.
-A diskgroup is divided into failure groups, and each disk is in exactly one failure group.
-A failure group is a collection of disks than can become unavailable due to failure of one of its associated components
-after create a diskgroup, redundancy level can not be changed.
-To change it: create new diskgroup and move the datafile(using RMAN), or ASMCMD copy command to the new diskgroup
-after assign a disk to a failure group, cannot reassign it to another failure group


ASM on VMware

April 20th, 2008 . by admin

  • VM Repare
  • Install XP
  • Install Oracle 10g Release 10.2
  • Create virtual disks
  • Install Synchronization Services Requirements for ASM
  • Create ASM Instance
  • Startup ASM instance
  • Create ASM Diskgroup
  • Create SPFile
  • Create Database
  • Check after Create Database

1.VM Repare

-RAM 768
-HardDisk: 18GB
-Ethernet Bridged
-Static IP exm: 192.168.1.65

 

2.Install XP

-OS: XP SP2
-Alternative: W2K3, W2000
 

 

 

3.Install Oracle 10g Release 10.2

all default, also ORACLE_HOME on c:\
 

 

4. Create virtual disks

c:> md c:\asmdisks
c:> asmtool -create c:\asmdisks\disk1 1000
c:> asmtool -create c:\asmdisks\disk2 1000
c:> asmtool -create c:\asmdisks\disk3 1000
c:> asmtool -create c:\asmdisks\disk4 1000
c:> asmtool -create c:\asmdisks\disk5 1000


 

note:
-this create a diskgroup with 5 disks size 5 * 1024.
-for every disk: 9 minutes (on my dual core 1.8GB)
-asmtools.exe can located in ORACLE_HOME\bin
-What is AMSTOOL?
see: http://download-uk.oracle.com/docs/cd/B28359_01/install.111/b28250/racstorage.htm
see pic 2

5.Install Synchronization Services Requirements for ASM

run: C:\oracle\product\10.2.0\db_1\bin\localconfig

 

C:\>localconfig add
Step 1:  creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'administrator', privgrp ''..
Operation successful.
Step 2: creating new CSS service
successfully created local CSS service
successfully added CSS to home

 

 

->Service ORACLECSService is created. siehe services.msc
 

6.Create ASM Instance

-Create file c:\oracle\product\10.2.0\db_1\database\init+ASM.ora mit following lines:

INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
LARGE_POOL_SIZE=8M
ASM_DISKSTRING='c:\asmdisks\*'
_ASM_ALLOW_ONLY_RAW_DISKS=FALSE 

Note: _ASM_ALLOW_ONLY_RAW_DISKS ist a undocumented parameter, is used to make the instance recognize virtual disks created on step 4

 

-Create ASM Service, run:

 

C:\>oradim -NEW -ASMSID +ASM -STARTMODE auto
Instance created.


->New Service OracleASMService+ASM is created.
see services.msc ->C:\oracle\product\10.2.0\db_1\database\hc_+asm.dat

Note: also, like as create database service..but -ASMSID +ASM
 

7.Startup ASM instance

 

C:\> set ORACLE_SID=+ASM
C:\> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 19 22:12:34 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
  ASM instance started
  Total System Global Area   79691776 bytes
  Fixed Size                  1247396 bytes
  Variable Size              53278556 bytes
  ASM Cache                  25165824 bytes
  ORA-15110: no diskgroups mounted

Check Status, instance_type, db_unique_name, asm_diskstring

SQL> select status from v$instance;
   STATUS
   ------------
   STARTED
SQL> show parameter instance_type
   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------
   instance_type                        string      ASM
SQL> show parameter db_unique_name
   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------
   db_unique_name                       string      +ASM
 

 

SQL> show parameter asm_diskstring
   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------
   asm_diskstring                       string      c:\asmdisks\*
   SQL>
 

 

8.Create ASM Diskgroup

first check, whic candidate disks for ASM

 

SQL> col path format a30
SQL> select path, mount_status from v$asm_disk;
   PATH                           MOUNT_S
   ------------------------------ -------
   C:\ASMDISKS\DISK1              CLOSED
   C:\ASMDISKS\DISK2              CLOSED
   C:\ASMDISKS\DISK5              CLOSED
   C:\ASMDISKS\DISK4              CLOSED
   C:\ASMDISKS\DISK3              CLOSED

note: alle Disks has mount_status CLOSED!
ASM see all 5 disks, now create Diskgroup:

SQL> create diskgroup DISKGROUP1 normal redundancy disk
   2  'c:\asmdisks\disk1',
   3  'c:\asmdisks\disk2',
   4  'c:\asmdisks\disk3',
   5  'c:\asmdisks\disk4',
   6  'c:\asmdisks\disk5';
Diskgroup created.

Note: parallel step with DBCA -Run DBCA->Welcome->Next-Choice Configure Automatic Storage Management->Create New
und view again the status:
 

SQL> select path, mount_status from v$asm_disk;
   PATH                           MOUNT_S
   ------------------------------ -------
   C:\ASMDISKS\DISK1              CACHED
   C:\ASMDISKS\DISK2              CACHED
   C:\ASMDISKS\DISK3              CACHED
   C:\ASMDISKS\DISK4              CACHED
   C:\ASMDISKS\DISK5              CACHED

note: alle Disks have now status CACHED!
 

SQL> col name format a20
SQL> select group_number, name, state, type, total_mb from v$asm_diskgroup;
   GROUP_NUMBER NAME                 STATE       TYPE     TOTAL_MB
   ------------ -------------------- ----------- ------ ----------
   1 DISKGROUP1           MOUNTED     NORMAL       5000
SQL> show parameter asm_disk
   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------------------
   asm_diskgroups                       string      DISKGROUP1
   asm_diskstring                       string      c:\asmdisks\*
   SQL>

 

9.Create SPFile

Now, we have a diskgroup with name DISKGROUP1. We must set parameter asm_diskgroups=DISKGROUP1
Must: Covert pfile to spfile

 

SQL> create spfile from pfile;

->C:\oracle\product\10.2.0\db_1\database\SPFILE+ASM.ORA wird erzeugt.

 

SQL> alter system set asm_diskgroups=DGROUP1 scope=spfile;
SQL> startup force;
   ASM instance started
   Total System Global Area   79691776 bytes
   Fixed Size                  1247396 bytes
   Variable Size              53278556 bytes
   ASM Cache                  25165824 bytes
   ASM diskgroups mounted
SQL>
SQL> col name format a15
SQL> select group_number, name, state, type, total_mb, free_mb from v$asm_diskgroup;
   GROUP_NUMBER NAME            STATE       TYPE     TOTAL_MB    FREE_MB
   ------------ --------------- ----------- ------ ---------- ----------
   1 DISKGROUP1      MOUNTED     NORMAL       5000       4843
SQL>

10. Create Database

-Run DBCA
-Dialog Welome. Click next
-Dialog Step 1 of 12. Choice Create a database. Click Next
-Dialog Step 2 of 12. Choice General Purpose. Click Next
-Dialog Step 3 of 12. Set Global Database Name=EDU4.neta1.net. SID=EDU4. Click Next
-Dialog Step 4 of 12. All Default. Click Next
-Dialog Step 5 of 12. Input Password. Click Next
=>>Dialog Step 6 of 12. Choice Automatic Storage Management (ASM).Click Next

 

C:\> orapwd file=C:\oracle\product\10.2.0\db_1\database\PWD+ASM.ora password=netazy

=>>Dialog Step 7 of 12. Check Diskgroup. Click Next
=>>Dialog Step 8 of 12. Datafile Locations. Click Next
-Dialog Step 9 of 12. Recovery Configuration. Flashback + Enable Archiving. Click Next
-Dialog Step 10 of 12. Check Sample Schema. Click Next
-Dialog Step 11 of 12. Initialization. Click Next
-Dialog Step 12 of 12. Database Storage. Click Next
 

11.Check after Create Database

C:\> set oracle_sid=EDU4
C:\> sqlplus /nolog
SQL> connect / as sysdba
SQL> 

 

SQL> select name from v$controlfile;
   NAME
   --------------------------------------------------------------------------------
   +DISKGROUP1/edu4/controlfile/current.261.652493311
   +DISKGROUP1/edu4/controlfile/current.260.652493313

 

SQL> select name from v$datafile;
   NAME
   --------------------------------------------------------------------------------
   +DISKGROUP1/edu4/datafile/system.256.652493205
   +DISKGROUP1/edu4/datafile/undotbs1.258.652493205
   +DISKGROUP1/edu4/datafile/sysaux.257.652493205
   +DISKGROUP1/edu4/datafile/users.259.652493205
   +DISKGROUP1/edu4/datafile/example.269.652493363

 

SQL> select name from v$tempfile;
   NAME
   --------------------------------------------------------------------------------
   +DISKGROUP1/edu4/tempfile/temp.268.652493351
SQL> select member from v$logfile;
   MEMBER
   --------------------------------------------------------------------------------
   +DISKGROUP1/edu4/onlinelog/group_3.266.652493331
   +DISKGROUP1/edu4/onlinelog/group_3.267.652493335
   +DISKGROUP1/edu4/onlinelog/group_2.264.652493323
   +DISKGROUP1/edu4/onlinelog/group_2.265.652493327
   +DISKGROUP1/edu4/onlinelog/group_1.262.652493317
   +DISKGROUP1/edu4/onlinelog/group_1.263.652493319
6 rows selected.

 

select A.name, F.file_number, F.incarnation, F.type
   from v$asm_alias A, v$asm_file F
   where A.file_number  = F.file_number
   order by F.type;

NAME                           FILE_NUMBER INCARNATION TYPE
------------------------------ ----------- ----------- ---------------
thread_1_seq_2.271.652493807           271   652493807 ARCHIVELOG
arc00002_0652493316.001                271   652493807 ARCHIVELOG
Current.261.652493311                  261   652493311 CONTROLFILE
Current.260.652493313                  260   652493313 CONTROLFILE
USERS.259.652493205                    259   652493205 DATAFILE
UNDOTBS1.258.652493205                 258   652493205 DATAFILE
SYSTEM.256.652493205                   256   652493205 DATAFILE
SYSAUX.257.652493205                   257   652493205 DATAFILE
EXAMPLE.269.652493363                  269   652493363 DATAFILE
group_2.265.652493327                  265   652493327 ONLINELOG
group_3.266.652493331                  266   652493331 ONLINELOG
group_3.267.652493335                  267   652493335 ONLINELOG
group_1.262.652493317                  262   652493317 ONLINELOG
group_2.264.652493323                  264   652493323 ONLINELOG
group_1.263.652493319                  263   652493319 ONLINELOG
spfile.270.652493597                   270   652493597 PARAMETERFILE
spfileEDU4.ora                         270   652493597 PARAMETERFILE
TEMP.268.652493351                     268   652493351 TEMPFILE

18 rows selected.

 

 


Create Oracle 10g database manual

April 12th, 2008 . by admin

Todo:

Set ORACLE_SID=ORAVN

1.Create Service

c:>oradim -new -sid ORAVN -intpwd netazy -startmode M

result this step:
-Run services.msc and looking for OracleServiceORAVN
-looking for password file in %ORACLE_HOME%\database
->pwdORAVN.ORA

2.Create mini PFile

Location %ORACLE_HOME%\database\initORAVN.ora with following:
 

control_files=(c:\oravn\control01.ora, c:\oravn\control02.ora, c:\oravn\control03.ora)
  undo_management=auto
  db_name=ORAVN
  db_block_size=8192
  SGA_MAX_SIZE=600M
  SGA_TARGET=600M

note: create directory c:\oravn, location for database, before run batch in step 5

3.Create a script c:\createdb.sql with:

CREATE DATABASE oravn
  LOGFILE GROUP 1 (’c:\oravn\redo01.log’) SIZE 100M,
  GROUP 2 (’c:\oravn\redo02.log’) SIZE 100M,
  GROUP 3 (’c:\oravn\redo03.log’) SIZE 100M
  MAXLOGFILES 5
  MAXLOGMEMBERS 5
  MAXLOGHISTORY 1
  MAXDATAFILES 100
  MAXINSTANCES 1
  CHARACTER SET US7ASCII
  NATIONAL CHARACTER SET AL16UTF16
  DATAFILE ‘c:\oravn\system01.dbf’ SIZE 325M REUSE
  EXTENT MANAGEMENT LOCAL
  SYSAUX DATAFILE ‘c:\oravn\sysaux01.dbf’ SIZE 325M REUSE
  DEFAULT TEMPORARY TABLESPACE tempts1
  TEMPFILE ‘c:\oravn\temp01.dbf’
  SIZE 20M REUSE
  UNDO TABLESPACE undotbs
  DATAFILE ‘c:\oravn\undotbs01.dbf’
  SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

4.Start instance, connect as sysdba and mount

 c:>sqlplus /nolog
  c:>connect sys/netazy as sysdba
  SQL> startup NOMOUNT

5.create database.

Run script c:\createdb.sql
 

 SQL> @c:\createdb.sql

note: restart db again!

 
 SQL> shutdown;
  SQL> startup open; 

 

6. Create data dictionary

  SQL> @?/rdbms/admin/catalog.sql
  SQL> @?/rdbms/admin/catproc.sql 

7.Connect as system, run pupbld.sql

SQL> connect system/manager
  SQL> @?/sqlplus/admin/pupbld.sql 

 

8. Create Listener using netca

 

9. Create repository for EM. Run

C:\>emca -config dbcontrol db -repos create

STARTED EMCA at Apr 12, 2008 3:40:17 PM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.

Enter the following information:
Database SID: ORAVN
Listener port number: 1521
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
—————————————————————–

You have specified the following settings

Database ORACLE_HOME ……………. C:\oracle\product\10.2.0\db_1

Database hostname ……………. NETA1
Listener port number ……………. 1521
Database SID ……………. ORAVN
Email address for notifications ……………
Outgoing Mail (SMTP) server for notifications ……………

—————————————————————–
Do you wish to continue? [yes(Y)/no(N)]: y
Apr 12, 2008 3:40:48 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at C:\oracle\product\10.2.0\db_1\cfgtoollog
s\emca\ORAVN\emca_2008-04-12_03-40-17-PM.log.
Apr 12, 2008 3:40:50 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) …
Apr 12, 2008 3:43:25 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Apr 12, 2008 3:43:28 PM oracle.sysman.emcp.ParamsManager getLocalListener
WARNING: Error retrieving listener for NETA1
Apr 12, 2008 3:43:30 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) …
Apr 12, 2008 3:44:20 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Apr 12, 2008 3:44:20 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://NETA1:1158/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 12, 2008 3:44:20 PM

Run EM per http://neta1:1158/em

 


Change hostname, recreate EM Repository

April 12th, 2008 . by admin

The Database Control Repository must be recreated,  if you will change the hostname

Todo:

1. Remove old configuration of OEM, type in CMD
emca -deconfig dbcontrol db -repos drop

note: db must be started

2. Remove OEM console service from registry, type on CMD
sc delete consoleServiceName

3. Remove the existing listener with netca (Net Configuration Assistant)

4. Edit tnsnames.ora, replace old with new hostname

5. Rename hostname, restart computer

6. Add new listeneer with Net Config Assistant

7. Run Listener

8. Startup database

9. Setup new OEM configuration
emca -config dbcontrol db -repos create

note: emca parameter
-config dbcontrol db: configure Database Control for a database
The Database Control Repository must be recreated,  if you when will change the hostname

Todo:

1. Remove old configuration of OEM, type in CMD
emca -deconfig dbcontrol db -repos drop

note: emca parameter
-deconfig dbcontrol db: de-configure Database Control
-repos drop: drop the current Database Control repository

2. Remove OEM console service from registry, type on CMD
sc delete consoleServiceName

3. Remove the existing listener with netca (Net Configuration Assistant)

4. Edit tnsnames.ora, replace old with new hostname

5. Restart the remaining oracle services. (Restart comp if not sure)

6. Add new listeneer with Net Config Assistant

7. Run Listener

8. Startup database

9. Setup new OEM configuration
emca -config dbcontrol db -repos create

note: emca parameter
-config dbcontrol db: configure Database Control for a database
-repos drop: drop current Database Control repository
-repos create: create a new Database Control repository
 


Change Language in Oracle Product to English

April 12th, 2008 . by admin

Change Language to English in Oracle Product
in DBCA, EMCA..

-Start Control Panel->Regional and Language Options
-On Tab Regional Options choice: (English (United States)

note:
-Start Universal Installer
-Welcome->Next
-Specifify Source Location->Next
-Select Installation Type->Product Language
-Move English from left to right ListBox
-Ok


SC – Service Control

April 6th, 2008 . by admin

SC – Service Control
Using SC is a command line program to control NT Service.
To controll Oracle service  exm:

-Query Status of a service
c:> sc query servicename (exm.OracleServiceEDU)

-stop a service
c:> sc stop servicename (exm.OracleServiceEDU)

-delete a service
c:> sc delete servicename (exm.OracleServiceEDU)

note: sc just remove the service from registry, to delete service use oradim

SC Full Help

C:\Documents and Settings\netazy>sc
DESCRIPTION:
        SC is a command line program used for communicating with the
        NT Service Controller and services.
USAGE:
        sc <server> [command] [service name] <option1> <option2>...

        The option <server> has the form "\\ServerName"
        Further help on commands can be obtained by typing: "sc [command]"
        Commands:
          query-----------Queries the status for a service, or
                          enumerates the status for types of services.
          queryex---------Queries the extended status for a service, or
                          enumerates the status for types of services.
          start-----------Starts a service.
          pause-----------Sends a PAUSE control request to a service.
          interrogate-----Sends an INTERROGATE control request to a service.
          continue--------Sends a CONTINUE control request to a service.
          stop------------Sends a STOP request to a service.
          config----------Changes the configuration of a service (persistant).
          description-----Changes the description of a service.
          failure---------Changes the actions taken by a service upon failure.
          qc--------------Queries the configuration information for a service.
          qdescription----Queries the description for a service.
          qfailure--------Queries the actions taken by a service upon failure.
          delete----------Deletes a service (from the registry).
          create----------Creates a service. (adds it to the registry).
          control---------Sends a control to a service.
          sdshow----------Displays a service's security descriptor.
          sdset-----------Sets a service's security descriptor.
          GetDisplayName--Gets the DisplayName for a service.
          GetKeyName------Gets the ServiceKeyName for a service.
          EnumDepend------Enumerates Service Dependencies.

        The following commands don't require a service name:
        sc <server> <command> <option>
          boot------------(ok | bad) Indicates whether the last boot should
                          be saved as the last-known-good boot configuration
          Lock------------Locks the Service Database
          QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
        sc start MyService

Would you like to see help for the QUERY and QUERYEX commands? [ y | n ]: y
QUERY and QUERYEX OPTIONS :
        If the query command is followed by a service name, the status
        for that service is returned.  Further options do not apply in
        this case.  If the query command is followed by nothing or one of
        the options listed below, the services are enumerated.
    type=    Type of services to enumerate (driver, service, all)
             (default = service)
    state=   State of services to enumerate (inactive, all)
             (default = active)
    bufsize= The size (in bytes) of the enumeration buffer
             (default = 4096)
    ri=      The resume index number at which to begin the enumeration
             (default = 0)
    group=   Service group to enumerate
             (default = all groups)
SYNTAX EXAMPLES
sc query                - Enumerates status for active services & drivers
sc query messenger      - Displays status for the messenger service
sc queryex messenger    - Displays extended status for the messenger service
sc query type= driver   - Enumerates only active drivers
sc query type= service  - Enumerates only Win32 services
sc query state= all     - Enumerates all services & drivers
sc query bufsize= 50    - Enumerates with a 50 byte buffer.
sc query ri= 14         - Enumerates with resume index = 14
sc queryex group= ""    - Enumerates active services not in a group
sc query type= service type= interact - Enumerates all interactive services
sc query type= driver group= NDIS     - Enumerates all NDIS drivers