Archive for the ‘Oracle Grid Control’ Category

Set the login info, otherwise you will give session expired error.

./emcli setup -url=https://source_hostname:7799/em  -username=sysman
./emcli export_report -title="Database Size" -owner="SYSMAN" -output_file="db_size.xml"
Report "Database Size", owned by "SYSMAN", has been exported from the repository.
Exported reports may not contain all information from original report.  Repository specific information such as targets, administrator access, and schedules are not exported.  Imported reports should be edited after import to supply all necessary report parameters.

In target

./emcli setup -url=https://target_hostname:7799/em  -username=sysman
./emcli import_report -files="db_size.xml"
File "db_size.xml" has been imported into the repository.
Imported reports should be edited after import to supply all necessary report parameters.
convert this post to pdf.
./emcli setup -url=https://source_hostname:7799/em -username=sysman

If you don’t issue the above command, you will get error like session expired. get the name and target type from below query

 SELECT TEMPLATE_NAME,TARGET_TYPE FROM sysman.MGMT_TEMPLATES ;
./emcli export_template -name="Common_Database_Template" -arget_type="oracle_database" -output_file=Common_Database_Template.out

./emcli export_template -name="Common_Sybase_Template" -target_type="sybase_ase" -output_file=Common_Sybase_Template.out

./emcli export_template -name="Common_Clusterdb_template" -target_type="rac_database" -output_file=Common_Clusterdb_template.out

./emcli export_template -name="Common_ASM_template" -target_type="osm_instance" -output_file=Common_ASM_template.out

./emcli export_template -name="Common_Agent_template" -target_type="oracle_emd" -output_file=Common_Agent_template.out

./emcli export_template -name="Common_listener_Template" -target_type="oracle_listener" -output_file=Common_listener_Template.out

./emcli export_template -name="Common_Host_template" -target_type="host" -output_file=Common_Host_template.out

To import

./emcli setup -url=http://target_hostname:7788/em -username=sysman

Make sure that if the oms is secured use https, if not use http in -url. If you want to import as different user you can change the -username to respective users.

 ./emcli import_template -files="Common_Database_Template.out;Common_Sybase_Template.out;
Common_Clusterdb_template.out;Common_ASM_template.out;
Common_Agent_template.out;Common_listener_Template.out;
Common_Host_template.out"

sybase template will fail if sybase plugin is not installed. If there is already a name with exisiting template, that template will not be added.

convert this post to pdf.

By mistake if you have used wrong port while configuring SLB, the oms will not come up.

./emctl secure oms -sysman_pwd xyz123 -reg_pwd abc123 -host hostname -secure_port 443 -slb_port 443 -slb_console_port 443

You will be getting below error while starting the oms.

./emctl start oms
Oracle Enterprise Manager 11g Release 1 Grid Control 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Starting WebTier…
WebTier Could Not Be Started
Error Occurred: WebTier Could Not Be Started
Please check /u01/app/oracle/Middleware/oms11g/em/EMGC_OMS2/sysman/log/emctl.log for error details

when you check the log, basically the apache will not start. You can see the error in /u01/app/oracle/Middleware/oms11g/WebTierIH1/diagnostics/logs/OHS/ohs1/ohs1.log

The error will look like

[pid: 9633918] [tid: 1] [user: oracle] [VirtualHost: main] (13)Permission denied:  make_sock: could not bind to address [::]:443
[pid: 9633918] [tid: 1] [user: oracle] [VirtualHost: main]  no listening sockets available, shutting down

3918] [tid: 1] [user: oracle] [VirtualHost: main]  Unable to open logs

you will have to change the port back in

/u01/app/oracle/Middleware/oms11g/WebTierIH1/config/OHS/ohs1/httpd_em.conf

note there will be a backup file automatically taken whenever any change to above file. Overwrite the correct copy with incorrect one.

convert this post to pdf.

There is easier way of  pointing agent to new oms in 11g.

Go the $AGENT_HOME/bin and execute just one command,

$ ./emctl switchOMS https://oms_hostname:1159/em/upload
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
SwitchOMS succeeded.

If you have agent registration passwd enabled, do the below steps,

$./emctl stop agent

$./emctl secure agent ‘pwd’

$./emctl start agent

Before 11g, you will have to follow steps given metalink#413228.1

convert this post to pdf.

In case if you have lost agent registration pwd and want to create new one. Go to setup=> registration pwd and remove the existing one.

then in the OMS server execute below command,

/emctl secure setpwd
Oracle Enterprise Manager 11g Release 1 Grid Control 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Enter Enterprise Manager Root Password :
Enter New Agent Registration Password :
Registration Password added successfully.

root password above is sysman password

convert this post to pdf.

It’s specific to AIX environment. While doing oms installation during the agent configuration stage it failed. Even a fresh installation of agent in oms host will fail with similar error. You will not be able to stop or start the agent.

It’s a aix bug, metalink#1298284.1 talks about it. There is a workaround provided in that note.

Workaround provided by Oracle:

1. export $ORACLE_HOME=<agent home>/sysman/lib
2. cd <agent home>/sysman/lib
3. backup env_emagent.mk
4. Modify env_emagent.mk:
   Search “LIB_JVM_LINK =”
   Remove the “-blazy” option from LIB_JVM_LINK definition
   Save the file
5. /usr/sbin/slibclean

5.1. export OBJECT_MODE=32 ==> Pls note this step is missing in the oracle document

6. make -f ins_emagent.mk agent

convert this post to pdf.

If you have used repvfy utility in grid control, pls see the sql generated under emdiag/log location. Out of repvfy a sql file generated and content of those sql’s are pretty useful.

Also on other note if you want to diagonise one target, you can use below command.

./repvfy -usr SYSMAN -tns emrep -pwd dump target -name -type oracle_database

convert this post to pdf.

If you have administered Grid Control, you would have known two types of corrective actions.

1. Corrective Action Script
2. Agent Response Script

What it does is you can invoke a remediation script based on an action. Suppose you want to add a datafile if the tablespace usage is nearing 95%, you can write a script and keep in the target server. Configure this script in metrics and policy setting of tablespace usage metrics. So whenever any tablespace usage crossing 95%, the script stored in the target server will be invoked.

The advantage is that it avoid human interference,errors and enhance the effective usage of DBA.

Consider if you have 1000s of targets and each targets you need to add remediation scripts to the metrics, it’s going to take lot of time.
What if i have option to invoke the Agent response script via sqlplus. It’s going to give me better control. I can write a package, which will poll the metrics tables and invoke the scripts based on varying conditions. This is not possible to implement in metrics and policy tab.

Opened a SR with oracle and justification like below is given,
1. We have 1000s of targets for most of which we need to enable response action. Manually updating each target is time consuming. We can’t have template as the scripts getting invoked will have different name based on db name.
2. There are different groups of targets for which invoking response actions script will be based on certain scenarios. If response action can be invoked manually, then we can put our conditions and invoke accordingly.
3. We will have control on one place. Modifying something will be quicker instead of going to each target’s metric & policy and changing.

We have filed enhancement request filed with oracle.

ER IS : Bug 10214800 – INVOKING ” RESPONSE ACTION” VIA SQLPLUS

convert this post to pdf.

Create a sql based user defined metrics with below script. SQL query output will be 2 colums with metrics value as number.

select tablespace_name,
100-(round(((mb_free+mb_total-mb_curr)/mb_total)*100,0)) adj_pct_free
from
(
select d.tablespace_name,
nvl(sum(f.bytes)/1024/1024, 0) mb_free,
sum(d.bytes)/1024/1024 mb_curr,
case when sum(d.maxbytes)>0 then sum(d.maxbytes)/1024/1024
else  sum(d.bytes)/1024/1024 end mb_total
from dba_data_files d left outer join dba_free_space f
on (f.tablespace_name = d.tablespace_name)
group by d.tablespace_name
) used_free
where tablespace_name not like '%UNDO%';
convert this post to pdf.

Recently upgraded the OMS from 10204 to 10205.
As part of we want to upgrade the agent to 10205 from lower version.
We have around 150 targets. So upgrading each is very difficult. Also fresh install requires to install base version apply 10205 patch, psu patch and other fixes. Doing in each server is difficult.

Instead, we installed 10205 with up to date patch in a sand box. Took tar and moved to servers where we need to patch.

After untaring,
./runInstaller -clone -forceClone ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=agent10205 -noconfig -silent
this will do the proper clone of the agent applying all the bugs
incase if you get complient like home already exist you can try,

./runInstaller -detachHome ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=agent10204 -noconfig -silent

once done

go to $AGENT_HOME/sysman/config
vi emd.properties
check and apply correct port to emd_url,repository_url,emdWallet
once done
secure the agent and start the agent

after which run
$ORACLE_HOME/bin/agentca -f

if its RAC run the below command. For Rac DB agent needs to be installed in both the server. Make sure the directory structures are same.
$ORACLE_HOME/bin/agentca -f -n “cluster1,cluster2″

Due to nic setting we might have issue in RAC. That case

“ListenOnAllNICs=false” in emd.properties if it’s cluster environment and getting http error port already used errorcheck note 443524.1

convert this post to pdf.

My OMS is in 10204. It’s very slow, one vital reason is we are running low on OS resource. We are planning to move to much higher configuration.

These are some of the changes which helped is putting the below entry in opmn.xml at $OMS_HOME/opmn/conf










===========













convert this post to pdf.

My OMS installed in very poor configuration. Can’t take any load. I applied a template by mistake for 750 target in a shot. My OMS crashed. It didnt’ came up. I tried bouncing, no luck. But i see some activity in my trace file.
Looks like it’s applying or doing something.
Ok, how long it is going to take before my OMS back up. Since my OMS crashed i can’t see how many pending jobs. Here i used below query to figure out how much pending and how much completed.

SELECT target_type “Target Type”,
target_name “Destination Target”,
template_name “Last Applied Template”,
copy_type “Apply Option”,
execution_status “Status”
FROM
(
SELECT mts.template_name template_name,
mt.target_name target_name,
mt.target_type target_type,
mtc.copy_type copy_type,
DECODE(muodt.execution_status,
1, ‘PENDING’,
5, ‘COMPLETE’,
2, ‘EXECUTING’,
3, ‘ABORTED’,
4, ‘FAILED’) execution_status,
mtc.created_date,
RANK () OVER (PARTITION BY mt.target_name,mt.target_type ORDER BY mtc.created_date
DESC ) rk
FROM mgmt_update_operations_details muodt,
mgmt_update_operations_data muoda,
mgmt_update_template_data_map mutdm,
mgmt_template_copies mtc,
mgmt_targets mt,
mgmt_templates mts
WHERE muodt.operation_guid = muoda.operation_guid
AND muoda.data_set_guid = mutdm.data_set_guid
AND muoda.data_set_type = 4
AND mutdm.template_copy_guid = mtc.template_copy_guid
AND mt.target_guid = muodt.destination_target_guid
AND mtc.template_guid = mts.template_guid
)
WHERE rk <=1
and template_name ='Prod - Database - Template' ==> my template name
ORDER BY 1,3,2 ;

convert this post to pdf.

I am trying to remove agent from OEM. It’s running for quite a while and no result seen. If your case is like this, you can use below command to remove.

exec mgmt_admin.cleanup_agent(‘hostname:1830′);

if you want to delete any target from command line use

exec mgmt_admin.delete_target(‘target_name’,'oracle_database’);

followed by

commit;

convert this post to pdf.

This i have seen in one of the forums. Which is something we are looking for sometime.

Not tried yet, but planning to implement soon once we migrate to much robust oem server.

export ORACLE_HOME=${AGENT_HOME}

Stop the agent:
${ORACLE_HOME}/bin/emctl stop agent

Save the file database.xmlp :
cp -p $ORACLE_HOME/sysman/admin/default_collection/database.xmlp $ORACLE_HOME/sysman/admin/default_collection/database.xmlp.orig

search for pattern <CollectionItem NAME=”tbspAllocation”>  or whatever and change the frequency to your requirement

<CollectionItem NAME=”tbspAllocation”>
<ValidIf>
<CategoryProp NAME=”VersionCategory” CHOICES=”pre8;8i;8iR2;9i;9iR2;10gR1;10gR2;10gR203;11gR1;11gR2″/>
</ValidIf>

<Schedule>
<IntervalSchedule INTERVAL=”7″ TIME_UNIT=”Day”/>
</Schedule>

<MetricColl NAME=”tbspAllocation” />
</CollectionItem>

Change the value of INTERVAL from 7 to 1 then save & quit.

Restart the agent :
$ORACLE_HOME}/bin/emctl start agent

The update will be shown in the Grid Control within 24H.

convert this post to pdf.

Our managment decided to give OEM access to development DBA. We were worried that development DBA might share the password to developer. There are 100s of developer in our environment. If everyone login to the OEM, this would create night mare. Since OEM is administration tool, we would prefer to be used by DBA.
How to protect development DBA sharing their pwd with developer. We tried something similar to sessions_per_user profile. Which didn’t work, as it is only for oracle user and not for OEM user.
Other approach is enable auditing on OEM user and if the login is coming from more than one ip, alert the dba.
By default, ip addr and hostname will not be registered in mgmt$audit_log. To enable it follow the metalink note#457382.1

exec mgmt_audit_admin.set_audit(0, null, 0);
shutdown the oms,opmn,agent
update
$OMS_HOME/Apache/Apache/conf/httpd.conf

make these 2 entries
UseWebCacheIp On
HostnameLookups On

restart the OMS.
After which each login in insert into mgmt_user_sessions table along with hostname and ipaddr. If a userid is used in more than one ipaddr, we can easily track.
select EM_USER,
             EM_USER_TYPE,
             EM_USER_HOST_NAME,
             OMS_HOST_NAME ,
             IP_ADDRESS
   from  MGMT_USER_SESSION
order by LOGIN_TIME desc;

But problem is this table might keep growing.
To do the purge,
Stop oms
exec mgmt_audit_admin.set_audit(0,null,2)
exec mgmt_audit_admin.audit_purge(’11-Jan-10′); — Give sysdate+1 to remove all the data

enable auditing
exec mgmt_audit_admin.set_audit(0, null, 0);
start OMS.

convert this post to pdf.

we have a requirement to alert for backup failures. Connecting to each rman repository or db to get this information is difficult. We have OEM, and this how we have implemented. We created UDM and applied to necessary targets.

Monitor DB fullbackup.

select count(*) from (select rownum no,x.status,x.end_time from (select status,end_time from v$rman_status where end_time is not null and object_type=’DB FULL‘ and end_time > sysdate-1 order by end_time desc) x) y where y.no=1 and y.status = ‘COMPLETED’

Monitor DB incr,

select count(*) from (select rownum no,x.status,x.end_time from (select status,end_time from v$rman_status where end_time is not null and object_type=’DB INCR‘ and end_time > sysdate-1 order by end_time desc) x) y where y.no=1 and y.status = ‘COMPLETED’

Archivelog backup.

select count(*) from (select rownum no,x.status,x.end_time from (select status,end_time from v$rman_status where end_time is not null and object_type=’ARCHIVELOG’ and end_time > sysdate-1 order by end_time desc) x) y where y.no=1 and y.status =’COMPLETED’

Other similar query which i came across is

select (sysdate-min(t))*24 from
(
  select max(b.CHECKPOINT_TIME) t
  from v$backup_datafile b, v$tablespace ts, v$datafile f
  where INCLUDED_IN_DATABASE_BACKUP='YES'
  and f.file#=b.file#
  and f.ts#=ts.ts#
  group by f.file#
)

for arch log monitoring,

select (sysdate-max(NEXT_TIME))*24 from v$BACKUP_REDOLOG

convert this post to pdf.

If you have hundreds of DB it will be usefull to have all the tns entry in your desktop. So for small task you don’t have to get into server. This will be saving lot of times. There are various way to create tns entry. The approach what i have used is from OEM.
If your shop is monitored by OEM, then you can use below script to generate tns entry and put it in your tns_admin location.
This procedure needs be compiled in sysman schema.

create or replace procedure rpt_tns_generation as
cursor c1 is
select distinct a.target_guid from mgmt_target_properties a,mgmt_targets b
where a.target_guid = b.target_guid
and b.target_type=’oracle_database’;

lv_sid varchar2(30);
lv_host varchar2(100);
lv_port number;
lv_service_name varchar2(100);
begin
for i in c1 loop
select property_value
into lv_sid
from mgmt_target_properties
where property_name=’SID’
and target_guid=i.target_guid;

select property_value
into lv_host
from mgmt_target_properties
where property_name=’MachineName’
and target_guid=i.target_guid;

select property_value
into lv_port
from mgmt_target_properties
where property_name=’Port’
and target_guid=i.target_guid;

dbms_output.put_line(lv_sid||’='||chr(10)||’(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=’||lv_host||’)(PORT=’||lv_port||’)))(CONNECT_DATA=(sid=’||lv_sid||’)))’);

end loop;

exception
when others then
dbms_output.put_line(‘error for ‘||sqlerrm);
end;
/

convert this post to pdf.

If your shop using OEM as monitoring tool, then you should be aware of this. If not try it out. Create a group and put all the DB under that group. If you get into the group you will see the launch dashboard. That will invoke the console. This will be one place where you get all the information. Critical,warning, target down, target unknow information. There is a option to customize also.
In our shop we have given a extra TFT monitor to each DBA and he moves this console to this extra monitor. After implementing this there was tremendous progress in our monitoring ability. We are on top of all the alerts now. If budget permits you can go for a wall mounted LCD

convert this post to pdf.

This tool needs to be installed in OMS server preferreably in OMS_HOME. Create a directory called “emdiag” to store these binaries.
You can follow the note 421053.1 and 421499.1 for this.
Once the installation is done you can get the debug details for all the target monitored using

./repvfy -usr SYSMAN -pwd  -tns emrep test -level 9 -detail

If you want to fix some of the debug issues you need to get the number from detail*.log or verify*.log in $EMDIAG_HOME/log location
These files will ahve info like,

001. Agents without a monitored host target: 1
101. Active Agents with clock-skew problems: 8
105. Agents not uploading any data: 6
106. Agents with improper ping status (5440008): 4
110. Agents not marked as potentially down (6314624): 4

so to fix 001 you need to run

$ ./repvfy -tns emrep verify blackouts -test 1 -fix

Please enter the SYSMAN password: 

-- --------------------------------------------------------------------- --
-- EMDIAG: 2009.0711     Repository: 10.2.0.4.0     06-Aug-2009 09:04:50 --
---------------------------------------------------------------------------
-- -- -- - Running in FIX mode: Data updated for all fixed tests - -- -- --
-- --------------------------------------------------------------------- --
verifyBLACKOUTS

These are some of the other module which can be fixed.

$ repvfy verify availability -test 100 -fix

$ repvfy verify targets -test 709 -fix
$ repvfy verify targets -test 705 -fix
$ repvfy verify targets -test 703 -fix
$ repvfy verify targets -test 702 -fix
$ repvfy verify targets -test 701 -fix
$ repvfy verify targets -test 206 -fix
$ repvfy verify targets -test 130 -fix
$ repvfy verify targets -test 122 -fix
$ repvfy verify targets -test 106 -fix

$ repvfy verify repository -test 706 -fix

$ repvfy verify policies -test 702 -fix
$ repvfy verify policies -test 700 -fix
$ repvfy verify policies -test 103 -fix
$ repvfy verify metrics -test 199 -fix
$ repvfy verify policies -test 101 -fix

$ repvfy verify metrics -test 705 -fix
$ repvfy verify ecm -test 799 -fix
$ repvfy verify metrics -test 703 -fix
$ repvfy verify metrics -test 110 -fix
$ repvfy verify targets -test 189 -fix

$ repvfy verify loaders -test 700 -fix

./repvfy -usr SYSMAN -tns emrep -pwd
 -module TARGETS -level 9 -detail
./repvfy -usr SYSMAN -tns emrep -pwd
 dump target -name  -type oracle_database
convert this post to pdf.

In many shops year on year a capacity planning will be done to find out how much space to be added. If you want to find out what are the mountpoint to which storage as to be added, you can get those information from OEM. Our client shop has more than 1000 targets. No way there to generate report from oem to find out what are the mountpoint reaching threshold.
If you know the sysman pwd, you can use below query to find out potential mountpoint to which you need to add space.

select b.host_name,b.target_name,a.key_value,a.message,a.collection_timestamp from MGMT_CURRENT_SEVERITY a,mgmt_targets b
where a.target_guid= b.target_guid and
(a.message_nlsid like 'host_file%' or a.message_nlsid like 'DiskGroup%' or a.message_nlsid like 'archFull%')
order by b.host_name asc,b.target_name asc,a.key_value asc,a.collection_timestamp desc
convert this post to pdf.
   We have an requirement where we have to send a monthly report on space usage and other details to management. Our shops has more than 600 DB. It's very difficult to get into each DB and generate these report. Luckily for us we use 10g OEM grid. So we have developed a script which uses owa_sylk (refer asktom) to generate the excel sheet. I am giving some of the code which we use.

Size of all the DB:
          This script gives hostname,db wise details. The size will be equilent to sum(bytes) from dba_extents.

declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'ALL';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_DB_Size.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select target_name DB_NAME,host_name Host,sum(trunc(tablespace_used_size/1024/1024/1024,2))size_GB'||
 '  from MGMT$DB_TABLESPACES group by host_name,target_name order by target_name ',
        p_sum_column =>
                 owa_sylk.owaSylkArray( 'N', 'N', 'Y'),
        p_show_grid => 'NO' ,
        p_user_heading => 'Size of ALL the DB as on '||sysdate);
    utl_file.fclose( output );
end;

Space usage of Arch location:
   This script generate space usage. This script may not work for all the environment, the pre-condition to it is, arch mountpoint should have "arch" keyword.
You need to create a table called RPT_ARCH_SIZES.

declare
    output utl_file.file_type;
    lv_host Varchar2(30) ;
    lv_file_name varchar2(30) ;
begin

    delete rpt_arch_sizes;

    Insert into rpt_arch_sizes select target_name,
     decode(instr(substr(mountpoint,instr(mountpoint,'/',-1)+1),'arch'),0,Upper(substr(mountpoint,instr(mountpoint,'/',-1)+1)),substr((substr(mountpoint,instr(mountpoint,'/',2)+1)),1,Instr(substr(mountpoint,instr(mountpoint,'/',2)+1),'/',1)-1)) database_name,
              mountpoint,
       trunc((sizeb/1024/1024/1024),2) Total_Size_GB ,
       trunc((usedb/1024/1024/1024),2)  Used_Space_GB,
       trunc((freeb/1024/1024/1024),2) Available_GB,
                            trunc((trunc((usedb/1024/1024/1024),2)/trunc                        ((sizeb/1024/1024/1024),2))*100,2) perc_Used
    from MGMT$STORAGE_REPORT_LOCALFS b
    where mountpoint like '%arch%';

    commit;

    lv_file_name := 'All_Storage_arch.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );

    owa_sylk.show(
        p_file => output,
      p_query => 'select target_name,upper(database_name) db_name,mountpoint,Total_Size_GB ,Used_Space_GB, Available_GB,perc_free Perc_used  '||
 ' from RPT_ARCH_SIZES order by perc_free desc ',

 p_show_grid => 'NO' ,

 p_user_heading => ' ARCHIEVELOG STORAGE REPORT OF ALL THE HOST as on '||sysdate);

 utl_file.fclose( output );

end;

Backup information of all the DB:
     The below script will give backup information. But in our environment, for some db the status and other columns are null. Need to look into that.

declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'All';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_Backup.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select host,Database_name,status,end_time,output_device_type '||
 ' from MGMT$HA_BACKUP order by end_time desc',
   p_show_grid => 'NO' ,
        p_user_heading => 'BACKUP REPORT Of all DB as on '||sysdate);

    utl_file.fclose( output );
end;

DB Features:
     This gives the list of DB features.
declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'oemrep';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_db_feature_info.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select Name,Currently_used,Description  '||
   '  from  MGMT$DB_FEATUREUSAGE  '||
   'where database_name=:HOSTNAME ',
          p_parm_names =>
               owa_sylk.owaSylkArray( 'HOSTNAME'),
       p_parm_values =>
                 owa_sylk.owaSylkArray( lv_target ),
        p_show_grid => 'NO' ,
        p_user_heading => 'DB feature info of '||lv_target||' as on '||sysdate);
    utl_file.fclose( output );
end;

Host Storage:
     This script will give host storage.

declare
    output utl_file.file_type;
    lv_host Varchar2(30) := 'cas2s040';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_host||'_Storage.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select mountpoint,trunc((sizeb/1024/1024),2) Total_Size_MB ,trunc((usedb/1024/1024),2)  Used_Space_MB,   trunc((sizeb/1024/1024),2) Available_MB '||
 ' from MGMT$STORAGE_REPORT_LOCALFS '||
 'where target_name=:HOSTNAME',
          p_parm_names =>
               owa_sylk.owaSylkArray( 'HOSTNAME'),
       p_parm_values =>
                 owa_sylk.owaSylkArray( lv_host ),
        p_sum_column =>
                 owa_sylk.owaSylkArray( 'N', 'Y', 'Y', 'Y'),
        p_show_grid => 'NO' ,
        p_user_heading => 'STORAGE REPORT Of '||lv_host||' as on '||sysdate);

    utl_file.fclose( output );
end;

Redo log size:
       This scripts gives the redo log file size for the inputted DB. Replace "oemrep" with your db name.

declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'oemrep';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_db_redo_info.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select group_num,members,thread_num,file_name,trunc(logsize/1024/1024,2) Redo_Size_MB,status '||
   '  from  MGMT$DB_REDOLOGS  '||
   'where target_name=:HOSTNAME ',
          p_parm_names =>
               owa_sylk.owaSylkArray( 'HOSTNAME'),
       p_parm_values =>
                 owa_sylk.owaSylkArray( lv_target ),
        p_show_grid => 'NO' ,
        p_user_heading => 'DB redolog info of '||lv_target||' as on '||sysdate);
    utl_file.fclose( output );
end;

DB features:
      DB features used in database. Change "oemrep" with your db name.

declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'oemrep';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_db_feature_info.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select Name,Currently_used,Description  '||
   '  from  MGMT$DB_FEATUREUSAGE  '||
   'where database_name=:HOSTNAME ',
          p_parm_names =>
               owa_sylk.owaSylkArray( 'HOSTNAME'),
       p_parm_values =>
                 owa_sylk.owaSylkArray( lv_target ),
        p_show_grid => 'NO' ,
        p_user_heading => 'DB feature info of '||lv_target||' as on '||sysdate);
    utl_file.fclose( output );
end;

Error Message:
     Error message encountered by the DB in last 3 months. Replace "oemrep" with your db name.

declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'oemrep';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_Err_hist.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select collection_timestamp,Metric_name,Error_message '||
 ' from MGMT$METRIC_ERROR_HISTORY '||
 'where target_name=:DATABASE_NAME order by 1',
          p_parm_names =>
               owa_sylk.owaSylkArray( 'DATABASE_NAME'),
       p_parm_values =>
                 owa_sylk.owaSylkArray( lv_target ),
   p_show_grid => 'NO' ,
        p_user_heading => 'Error REPORT Of '||lv_target||' for last 3 months');

    utl_file.fclose( output );
end;

DB init parameters:
       This script will give init.ora parameters for DB. Change "oemrep" with your dbname.

declare
    output utl_file.file_type;
    lv_target Varchar2(30) := 'oemrep';
    lv_file_name varchar2(30) ;
begin

    lv_file_name := lv_target||'_db_param.slk';

    output := utl_file.fopen( 'UTL_FILE_DIR', lv_file_name, 'w', 32000 );
    owa_sylk.show(
        p_file => output,
        p_query => 'select Name,Value,isdefault  '||
   '  from  MGMT$DB_INIT_PARAMS '||
   'where target_name=:HOSTNAME ',
          p_parm_names =>
               owa_sylk.owaSylkArray( 'HOSTNAME'),
       p_parm_values =>
                 owa_sylk.owaSylkArray( lv_target ),
        p_show_grid => 'NO' ,
        p_user_heading => 'DB parameter info of '||lv_target||' as on '||sysdate);
    utl_file.fclose( output );
end;



Visitors Count

convert this post to pdf.

This note covers, how to change the oem repository server.

OEM is a monitoring tool used in many of the shops around the world. As number of target increases, we need to either upgrade the existing repository server or move to new repository server.

If your company decides to move to new server, then we need to change the agent configuration on each target.

Please follow the below steps in each agent to point to new server.

Go to $AGENT_HOME/bin

execute below command to stop the agent,
./emctl stop agent
Execute the below command to unsecure the agent,
./emctl unsecure agent
We need to delete serious of files,  as this file might point to old oem respository server.
cd ../sysman/emd/upload
rm *.*
cd ../state
rm *.*
cd ../upload
rm *.*
cd ../collection
rm *.*
cd ..
rm agntstmp.txt
rm lastupld.xml
Go to $AGENT_HOME/sysman/config and open emd.properties
change the below entry to point to new server,

That’s it.

Now restart the agent.

Go to $AGENT_HOME/bin

./emctl clearstate agent
./emctl upload agent
./emctl secure agent <password>
./emctl start agent
Agent password is what you supplied while installing the oem repository.
New OEM repository server should be able to deduct the agent now.



Visitors Count

class="statcounter">

href=”http://www.statcounter.com/blogger/”
target=”_blank”> src="http://c.statcounter.com/4628332/0/06d2759c/0/"
alt="blogspot visitor" >


convert this post to pdf.