Today, I had to create a single row from:
Select tablespace_name from dba_tablespaces ;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
This can easily be done with (11.2 and up):
select contents,listagg(TABLESPACE_NAME,',')
within group
(order by CONTENTS) my_tbs
from dba_tablespaces
group by contents;
CONTENTS MY_TBS
--------- ---------------------------------------------
PERMANENT SYSAUX,SYSTEM,USERS
TEMPORARY TEMP
UNDO UNDOTBS1
This works nice!
01 November 2016
29 March 2016
kill repeating job when running longer than n minutes
Some repeating jobs may be running in a loop now and then, or should be killed after N minutes for whatever reason you may think off.
You can raise an event when a scheduled job is running longer than N minutes, but this event has to be handled. Otherwise, the job will just continue to run.
Below a small example how to set this up for MYJOB. Important to run from the job owner!
--connect as jobowner:
conn jobowner/password
-- create a table for output
create table JOB_OUTPUT (
log_date timestamp with time zone
,output varchar2(4000));
-- add an event queue subscriber for this user's messages
exec dbms_scheduler.add_event_queue_subscriber('myagent');
-- set the maximum run time for the jobbegin
dbms_scheduler.set_attribute(name=>'MYJOB',attribute=>'max_run_duration',value=> numtodsinterval(120,'minute'));
end;
/
-- create a 'sniper' job to kill MYJOB - based on eventbegin
dbms_scheduler.create_job
('KILL_MYJOB',
job_type=>'plsql_block',
job_action=>
'insert into job_output values(systimestamp, ''kill_myjob started'');
dbms_scheduler.stop_job(''KILL_MYJOB'',false);',
event_condition =>
'tab.user_data.object_name = ''MYJOB'' and
tab.user_data.event_type = ''JOB_OVER_MAX_DUR''',
queue_spec =>'sys.scheduler$_event_queue,myagent',
enabled=>true);
end;
/
-- you can see in the output table if the job was killed:
select * from JOB_OUTPUT;

31 December 2015
Migrating your Software Library in Oracle Enterprise Manager 12.1.0.5
The Software Library should be kept on a location where multiple OMS instances can reach it under the same path-name when working with multiple-OMS.
So some sort of shared storage is needed. This may lead to the need to migrate your software libary.
This is a very simple task once you've seen it. Below I will move the software libary from:
/oracle/software/softlib to a new mountpoint /swlib .
First, go to the Software Libary under Setup > Provisioning and Patching.
Second, observe the software library you have and click Add button to create a new one.
Third, select the old software library and select Migrate and Remove button.
Fourth, in the popup window, select your target software libary from the pulldown.
Observe the confirmation box and click View Job.
The job runs for a few minutes, just wait or get some coffee.

So you can free up that space by removing the old directory.
Further reading:
https://docs.oracle.com/cd/E24628_01/doc.121/e24473/softwarelib.htm#EMADM11710
So some sort of shared storage is needed. This may lead to the need to migrate your software libary.
This is a very simple task once you've seen it. Below I will move the software libary from:
/oracle/software/softlib to a new mountpoint /swlib .
First, go to the Software Libary under Setup > Provisioning and Patching.
Second, observe the software library you have and click Add button to create a new one.
Third, select the old software library and select Migrate and Remove button.
Fourth, in the popup window, select your target software libary from the pulldown.
Observe the confirmation box and click View Job.
The job runs for a few minutes, just wait or get some coffee.
Now the old software library is gone from the Cloud Control:
But it's still on your host:
So you can free up that space by removing the old directory.
Further reading:
https://docs.oracle.com/cd/E24628_01/doc.121/e24473/softwarelib.htm#EMADM11710
23 December 2015
First installation of Cloud Control 13c
Just yesterday downloaded, and already running in my Virtualbox.
Some things to look for: make sure you have enough memory on your OMS host, at least 10Gb.
Other things I had to correct:
yum install glibc-devel.i686
/etc/sysctl.conf:
net.ipv4.ip_local_port_range = 11000 65000
sysctl -p
Physical Memory: 10240 MB
Make sure your EMREP database is precreated and runs in 12.1.0.2, with parameter settings:
compatible: 12.1.0.2
optimizer_adaptive_features=FALSE
session_cached_cursors=200 (200 to 500 will do)
Diskspace in my test environment:
1.3Gb agent
6.2Gb app
2.1Gb gc_inst
14Gb Middleware
5.2Gb Oradata --> local Repository
700Mb swlib
This is just a small install without any targets. The software itself is not counted in this.
The installations is different than we saw before, you get 5 files, 1 .bin and 4 zips. Don't extract the zips. Just chmod+x the bin and run ./em13100_linux.bin
This will show:
0%...............................................100%
and then launch the installer.
Ok, installation took me about two hours. The login screen is finally re-designed (what a relief).
Some things to look for: make sure you have enough memory on your OMS host, at least 10Gb.
Other things I had to correct:
yum install glibc-devel.i686
/etc/sysctl.conf:
net.ipv4.ip_local_port_range = 11000 65000
sysctl -p
Physical Memory: 10240 MB
Make sure your EMREP database is precreated and runs in 12.1.0.2, with parameter settings:
compatible: 12.1.0.2
optimizer_adaptive_features=FALSE
session_cached_cursors=200 (200 to 500 will do)
Diskspace in my test environment:
1.3Gb agent
6.2Gb app
2.1Gb gc_inst
14Gb Middleware
5.2Gb Oradata --> local Repository
700Mb swlib
This is just a small install without any targets. The software itself is not counted in this.
The installations is different than we saw before, you get 5 files, 1 .bin and 4 zips. Don't extract the zips. Just chmod+x the bin and run ./em13100_linux.bin
This will show:
0%...............................................100%
and then launch the installer.
Ok, installation took me about two hours. The login screen is finally re-designed (what a relief).
And the Enterprise Summary screen looks a lot familiar, new template, but feels familiar.
Can't wait to explore it all...
Subscribe to:
Posts (Atom)