Utlrp.sql script job schedule from OEM
Any users on how to create grid control job for recompiling object via below script:
@?/rdbms/admin/utlrp.sql
I tried few testing but all failing at
SQL> SQL> SQL> SQL> SQL> SELECT dbms_registry_sys.time_stamp('utlrp_bgn') as timestamp from dual
ERROR at line 1:
ORA-00904: "DBMS_REGISTRY_SYS"."TIME_STAMP": invalid identifier
(creating job as SQL script)
Thanks,
Hi Users,
Thanks for all responses.
Thanks Absorbine, it was really funny l laughed on that.
OrionNet, I am trying to run this on atleast 5 db instances and also not real expert in procedures.
Basically I am trying to create OEM job to run utlrp.sql or UTL_RECOMP pacakages on 5 different db instances.
Tried below:
1. created job with utlrp.sql:
@?.rdbms/admin/utlrp.sql;
Error:
SQL> SQL> SQL> SQL> SQL> SELECT dbms_registry_sys.time_stamp('utlrp_bgn') as timestamp from dual
ERROR at line 1:
ORA-00904: "DBMS_REGISTRY_SYS"."TIME_STAMP": invalid identifier
2. Created job with UTL_RECOMP:
SQL Script:
WHENEVER SQLERROR EXIT FAILURE;
EXEC UTL_RECOMP.recomp_serial;
Error:
SQL> SQL> SQL> SQL> SQL> BEGIN utl_recomp.recomp_serial ; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'UTL_RECOMP.RECOMP_SERIAL' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
cheers,
Rapchik
Similar Messages
-
SQL Script Job using UTL_Mail.send Fails
Hi everyone,
This is 10.2.0.4 on Windows
I have configured UTL_Mail and it works when I send mail via SQL Plus.
Now, I'm just trying to get my very simple SQL Script job to send an email.
This is all that's in the command box (I'm using the Database Control to create the job)
exec UTL_MAIL.send(sender => '[email protected]',
recipients => '[email protected]',
cc => '[email protected]',
bcc => '[email protected]',
subject => 'UTL_MAIL Test',
message => 'Job ULTRAPRD WHOLE BKUP Email on PNCLULTRAPRD has completed successfully');
Output Log
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jul 17 09:36:32 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> SQL> SQL> SQL> Connected.
SQL> SQL> BEGIN UTL_MAIL.send(sender => '[email protected]',; END;
ERROR at line 1:
ORA-06550: line 1, column 53:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternatively-q
SQL> SP2-0734: unknown command beginning "recipients..." - rest of line ignored.
SQL> SP2-0734: unknown command beginning "cc ..." - rest of line ignored.
SQL> SP2-0734: unknown command beginning "bcc ..." - rest of line ignored.
SQL> SP2-0734: unknown command beginning "subject ..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SQL> SP2-0734: unknown command beginning "message ..."
Thanks for any ideas. john
Edited by: user629010 on Jul 17, 2009 5:11 PM
Edited by: user629010 on Jul 17, 2009 5:13 PMSure.
This simple job was created via Database Control Create Job option.
The 'Job Activity' form shows 'Succeeded' but I did not receive the email. But if sent via SQL Plus i do receive the email.
This is the SQL Script code: Type: SQL Script
BEGIN
UTL_MAIL.send(sender => '[email protected]',
recipients => '[email protected]',
cc => '[email protected]',
bcc => '[email protected]',
subject => 'UTL_MAIL Test',
message => 'Hi, this is an email from Oracle on server PNCLULTRAPRD!');
END;
The Output log shows:
Step: command step
Page Refreshed Jul 19, 2009 9:17:42 PM
Status Succeeded
Targets ultraprd
Started Jul 19, 2009 8:37:06 PM GMT-05:00
Ended Jul 19, 2009 8:37:08 PM GMT-05:00
Elapsed Time 2 seconds
Output Log
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jul 19 20:37:06 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> SQL> SQL> SQL> Connected.
SQL> SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 Disconnected from Oracle Database 10g Enterprise Edition Release
Thanks, John -
Utlrp.sql script from OEM
Any users on how to create grid control job for recompiling object via below script:
@?/rdbms/admin/utlrp.sql
I tried few testing but all failing at
SQL> SQL> SQL> SQL> SQL> SELECT dbms_registry_sys.time_stamp('utlrp_bgn') as timestamp from dual
ERROR at line 1:
ORA-00904: "DBMS_REGISTRY_SYS"."TIME_STAMP": invalid identifier
Thanks,i recreated sysaux because one of our developer add datafile (for sysaux) in home location not in +ASM, that is also only for prod1 not at both
the location then after some days i was getting ora-600 then i found that wrongly add datafile sysaux.
then i copied that datafile to other location also.after that ora-600 gone...but after some days i restarted database
that time it was asking for recovery of sysaux,as we dont have any and any kind of backup and archivelog
i made offline to that sysaux tablespace,after making offline we are facing problem at very activity so we recreated
sysaux . . . .. -
Hi,
I have multiple SQL agent jobs , i need to schedule these jobs to run one after other , below explanation should give you more info
job 1 scheduled every day @ 12 : 00 am
job 2 scheduled every day @ 2 : 00 am
job 3 scheduled every day @ 3 : 00 am
Issue here is some times my job 2 is starting before job 1 finishes . Which is causing problems
i want job 2 run only after job 1 is done and job 3 after job 2 and goes on
can some one please help how to do this ,any help will be appreciatedIf you want the process to be sequential why not merge all of the processes into same job itself as different consecutive steps? That would be the easiest to ensure they run in sequence
If thats not possible then way to do this is as follows
1.Add a new first step to Job 2 and Job 3 as follows
IF EXISTS(
select 1
from msdb.dbo.sysjobs_view job
inner join msdb.dbo.sysjobactivity activity on job.job_id = activity.job_id
where
activity.run_Requested_date is not null
and activity.stop_execution_date is null
and job.name = <Previous Job Name Here>
RAISERROR 'Previous Job Not Completed Yet!',16,1
Replace job name correctly based on your case
Then in advanced tab make On Failure Action as quit the job reporting failure and OnSuccessAction
to default. Also set retry attempts to non zero number (say 10) and
retry interval to say 15 minutes
Once this is done Job 2 will start and keep on failing until Job 1 gets finished and it will retry itself in 15 minutes for 10 times. When Job 1 finishes in the interim the next retry will be a success and job will quit.
Do the same for Job 3 too replacing name of the job as that of Job2
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
For running utlrp.sql need users termination from the database?
Hai All,
My database jobs terminated in some time. So I want to run utlrp.sql for compiling all invalid objects. Is It needs users termination from the database? or login to restricted session? Please give a correct step for doing this activity..
Please help?
Shijudatabase? or login to restricted session? Please
give a correct step for doing this activity..
It is good , if you run utlrp.sql in restricted mode also set job_queue_processes =0 and check no dbms_job running package ( if package is valid then fine ). Problem only come when package/procedure are locked/in use by session. If invalid package are not used by any session then you can run utlrp.sql without restricted mode also. Well you know better you application.
Since you not altering any dependencies, just want to compile , you can run without restricted mode.
Virag -
Good Morning All
Does anyone know of a script/method of where I can obtain the following SQL Server Agent Job Information: -
Job Name, Owner, Description, Enabled, Schedule Description, Last Run
I've just joined another company and I've been tasked with auditing the SQL Servers here as this has never been done before.
Many thanks
Please click "Mark As Answer" if my post helped. Tony C.--WORK for SQL Server 2000 or later
-- Get information about all jobs that exists in a specific server or
-- get information about long running jobs in a specific server.
-- PLEASE! To retrieve information about long running jobs uncomment the WHERE clause
-- in the end of file.
-- Reference:
http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1302809_mem1,00.html
-- job_state:
-- 0 = Not idle or suspended,
-- 1 = Executing,
-- 2 = Waiting For Thread,
-- 3 = Between Retries,
-- 4 = Idle,
-- 5 = Suspended,
-- 6 = WaitingForStepToFinish,
-- 7 = PerformingCompletionActions
SET NOCOUNT ON
--creating a temporary tables.
--##tbl_joblist
IF EXISTS
(SELECT 1 FROM tempdb..sysobjects
WHERE type = 'U' AND name = '##tbl_joblist')
DROP TABLE ##tbl_joblist
CREATE TABLE ##tbl_joblist (
job_id
UNIQUEIDENTIFIER NOT NULL,
last_run_date
INT NOT NULL,
last_run_time
INT NOT NULL,
next_run_date
INT NOT NULL,
next_run_time
INT NOT NULL,
next_run_schedule_id
INT NOT NULL,
requested_to_run
INT NOT NULL,
request_source
INT NOT NULL,
request_source_id
sysname NULL,
running
INT NOT NULL,
current_step
INT NOT NULL,
current_retry_attempt
INT NOT NULL,
job_state
INT NOT NULL,
ServerName
sysname NULL,
JobName
sysname NULL
--##tbl_jobs
IF EXISTS
(SELECT 1 FROM tempdb..sysobjects
WHERE type = 'U' AND name = '##tbl_jobs')
DROP TABLE ##tbl_jobs
CREATE TABLE ##tbl_jobs (
job_id
UNIQUEIDENTIFIER PRIMARY KEY,
JobName
sysname
--inserting data
--##tbl_joblist
INSERT INTO ##tbl_joblist
(job_id,last_run_date,last_run_time,next_run_date,next_run_time,next_run_schedule_id,requested_to_run,request_source,request_source_id,running,current_step,current_retry_attempt,job_state)
-- Run it as SA (1), so ‘aaa’ is a dummy login name:
EXEC ('EXECUTE master.dbo.xp_sqlagent_enum_jobs 1, ''aaa'' ')
GO
--##tbl_jobs
INSERT INTO ##tbl_jobs select job_id, name from msdb.dbo.sysjobs
--adding server name and job name into ##tbl_joblist from ##tbl_jos
DECLARE @servername sysname
SELECT @servername = @@servername
UPDATE ##tbl_joblist
SET ServerName = @ServerName, JobName =j.JobName
FROM ##tbl_joblist r
INNER JOIN ##tbl_jobs j ON r.job_id = j.job_id
WHERE r.ServerName IS NULL
--checking for long job running
SELECT 'Long job running '
SELECT
ServerName AS "Server Name",
Jobname AS "Job Name",
last_run_date AS "Last Run Date",
last_run_time AS "Last Run Time",
--CAST(LEFT(CAST(last_run_date AS varchar(8)),4) + '/' + SUBSTRING(CAST(last_run_date AS varchar(8)), 5,2) + '/' + RIGHT(CAST(last_run_date AS varchar(8)), 2) + ' ' + CAST(((last_run_time/10000) %100)
AS varchar) + ':' + CAST(((last_run_time/100) %100) AS varchar) + ':' + CAST((last_run_time %100) AS varchar) AS DATETIME) AS 'Last Run Date & Time',
job_state AS "Job State",
CASE job_state
WHEN 0 THEN 'Not idle or Suspended'
WHEN 1 THEN 'Executing'
WHEN 2 THEN 'Waiting For Thread'
WHEN 3 THEN 'Between Retries'
WHEN 4 THEN 'Idle'
WHEN 5 THEN 'Suspended'
WHEN 6 THEN 'Waiting For Step To Finish'
WHEN 7 THEN 'Performing Completion Actions'
END AS 'Job State',
next_run_date AS "Next Run Date",
next_run_time AS "Next Run Time",
current_step AS "Current Step",
current_retry_attempt AS "Current Retry Attempt"
FROM ##tbl_joblist
--For Long Running Jobs
--WHERE job_state in (0,1,2,3,6,7)
--AND (CAST(LEFT(CAST(last_run_date AS varchar(8)),4) + '/' + SUBSTRING(CAST(last_run_date AS varchar(8)), 5,2) + '/' + RIGHT(CAST(last_run_date AS varchar(8)), 2) + ' ' + CAST(((last_run_time/10000) %100) AS varchar) + ':' +
CAST(((last_run_time/100) %100) AS varchar) + ':' + CAST((last_run_time %100) AS varchar) AS DATETIME)) <= DATEADD(HOUR, -2, GETDATE())
--Cleanup
DROP TABLE ##tbl_joblist
DROP TABLE ##tbl_jobs
GO
-- Get JobSteps info
USE [msdb]
GO
SELECT
--j.job_id,
-- s.srvname,
j.name,
js.step_id,
js.command,
j.enabled
FROM dbo.sysjobs j
JOIN dbo.sysjobsteps js
ON js.job_id = j.job_id
JOIN master.dbo.sysservers s
ON s.srvid = j.originating_server_id
--WHERE js.command LIKE N'%KEYWORD_SEARCH%'
Regards,
Edvaldo Castro
Edvaldo Castro http://edvaldocastro.com MCITP Database Administrator on SQL Server® 2008 MCITP Database Administrator on SQL Server® 2005 MCTS: SQL Server® 2008 MCTS: SQL Server® 2005 MCT: Microsoft Certified Trainer MTA: Microsoft Technology Associate
MTAC – Microsoft Technical Audience Contributor CCSQLA – Cambridge Certified SQL Associate TOEIC – Test of English for International Communication -
Restrict Periodic jobs scheduling from SM36 or any other t-code
HI,
We would like to restrict users from scheduling periodic background jobs. Immediate jobs will be fine.
And also one more concerns is that user should not be able to directly execute any report or transaction in background periodically.
In short immediate jobs will be fine but users should not be able to set periodic jobs by any T-code.
Thanks,
Chandresh PranamiIf you search for "btcoptions" you will find a comprehensive discussion about this, and a development suggestion in the wiki.
I attempted the same and ended up recreating the UI from scratch and scheduling the report + variant from a parameter transaction they are authorized for, but the user can navigate in many transactions showing this option.
A compensating control when retiring users and central batch administration with monitoring is easier.
Cheers,
Julius -
How to call PL-SQL script/stored procedure from Java?
Assume I want to call a PL-SQL stored procedure from external Java program.
How can I do this?
Is there a simple "Hello world" example for this?
PeterThis forum is for Oracle only not for java
Ug -
How to call PL-SQL script/stored procedure from BPEL?
Assume I want to call a PL-SQL stored procedure from BPEL.
How can I do this?
Is there a simple "Hello world" example for this?
PeterThe database adapter supports calling stored procedures. There is an example called "File2StoredProcedure" that you can use as a reference to get started.
-
Using &variables in a SQL Script scheduled job within OEM
Hi...I've been searching through the forum looking for any examples of setting up a job within OEM, using the SQL Script job type, where I can basically use a WHERE clause that says 'where column_name = &variable_name' and somehow provide that at run time, as if I were in a SQL*Plus session and using a PROMPT and ACCEPT command. I thought there might be a way to emulate that situation by placing the value I'd like to qualify on within some placeholder in the Parameter section of the job. We have a few users who have limited access to OEM and need to run queries on GRANTS and ROLES for various users etc. I realize there are other ways to do this, however I'm wondering if OEM has a capability like this. Any info is appreciated! Tks!
Looks like you're missing the schema name and you'll want to use QUOTENAME to add delimiters to the objects
e.g.
DECLARE @DATABASE AS VARCHAR(50)
DECLARE @SchemaName as SYSNAME;
DECLARE @TABLE AS VARCHAR(50)
DECLARE @QUERY AS VARCHAR(MAX)
SELECT @DATABASE = '602'
SELECT @SchemaName = 'dbo' --change as appropriate
SELECT @TABLE = 'Items'
SET @QUERY = 'SELECT TOP 10 * FROM ' + QUOTENAME(@DATABASE)+'.' + QUOTENAME(@SchemaName) + '.'+QUOTENAME(@TABLE)
print @query
EXEC( @QUERY) -
OEM12c Job - Run a SQL Script from a central location against multiple targets
Hi All:
I need to execute a SQL script that can be run as OEM Job against multiple targets from a single location so that the output csv files are all in that central location. My problem is that the sql script job documentation says "Make sure that the script file is installed in the appropriate location on all targets". Is anyone aware of a way I can do this so that the SQl script is executed from a location on my OMS console?
CheersHi
Create SQL job to run against on the server. Save those results (csv) file in local target. And crete one OS job, to collect all csv files into your OMS Console.
Regards
Krishnan -
Getting the RMAN scripts triggered from OEM ?
RDBMS Version : 11.2.0.3/RHEL 5.4
In our shop, Level 0 , Level 1 scripts are triggered from OEM. I am not an OEM guy :). Is there any way I could retrieve the RMAN scripts used to perform L0 and L1 backups ?Hi,
Connect to EM.
Go to Availability tab, go to Schedule Backup menu under Manage.
There you can see: Backup Jobs link.
You can remove or edit this jobs.
Mahir M. Quluzade
http://www.mahir-quluzade.com -
SQL script with host command job in Enterprise Manger Grid Control
I use Enterprise Manger Grid Control 10.2.0.5 and need to create SQL script job on database instance target on unix/linux platform.
I have problem with os command inside sqlplus script.
For example for the simple command: SQL> host ls
I get the message in output log: SQL> SQL> SQL> SQL> SQL> SQL> /bin/bash: ls: command not found
Can anyone help me?
Thank you.Hi,
Make sure you have granted all necessary rights (log on as a batch job etc.) to the user used in the prefered credentials.
Cheers,
Kenneth -
SQL Server Agent Job Scheduler- Set time less than 10 seconds
Hi,
Could any one please let me know how to change the SQL server agent Job scheduler time to less than 10 secs?
I wan to schedule a SSIS package run for every 5 secs.
Thanks..Be careful, it is a bad idea to blindly just issue a new package run without knowing whether the previous package ended.
It may lead to locking/dead-locking.
Now re the Agent: the seconds are not exposed at all, why you say 10?
But, there is a way, not through the UI, explained there:http://stackoverflow.com/questions/5569415/is-there-a-way-to-set-a-sql-server-job-scheduled-to-run-every-30-seconds + http://www.sqlservercentral.com/articles/Administration/sqlserverjobscheduling/2288/
PS you can have it every sec
Arthur My Blog -
Having trouble getting a job to run using job scheduler
I am using Oracle 11g. I run a sql script that schedules a job:
exec sys.dbms_scheduler.create_job( job_name => '"SYSTEM"."UCR"', job_type => 'EXECUTABLE', job_action => 'D:\UserCountReport\bin\ucr.bat', repeat_interval => 'FREQ=HOURLY;BYHOUR=3;BYMINUTE=0;BYSECOND=0',start_date => to_timestamp_tz('2011-07-21 US/Eastern', 'YYYY-MM-DD TZR'), job_class => 'DEFAULT_JOB_CLASS', auto_drop => FALSE,enabled => FALSE);
exec sys.dbms_scheduler.set_attribute( name => '"SYSTEM"."UCR"', attribute => 'job_weight', value => 1);
exec sys.dbms_scheduler.enable( '"SYSTEM"."UCR"' );
commit;
exit;When I am connected to the database, I run these commands:
SQL> SELECT JOB_NAME, STATE, job_action, repeat_interval FROM DBA_SCHEDULER_JOBS
where job_name='UCR';
JOB_NAME
STATE
JOB_ACTION
REPEAT_INTERVAL
UCR
SCHEDULED
C:\UserCountReport\bin\ucr.bat
FREQ=HOURLY;BYHOUR=9;BYMINUTE=0;BYSECOND=0
SQL> SELECT JOB_NAME, status FROM DBA_SCHEDULER_JOB_LOG where job_name = 'UCR';
JOB_NAME
STATUS
UCR
SUCCEEDED
UCR
SUCCEEDED
UCR
SUCCEEDEDHowever, I don't get any signs that the job has run even though Oracle says all the runs have succeeded. The batch file that the job is supposed to execute creates a file and writes stuff to it. However, the file is not written. When I run the batch file from command prompt, it executes correctly.
I have tried following instructions here:
Answers to "Why are my jobs not running?"
However, all three of these commands return errors:
SQL> select value from v$parameter where name='job_queue_processes';
select value from v$parameter where name='job_queue_processes'
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select count(*) from dba_scheduler_running_jobs;
select count(*) from dba_scheduler_running_jobs
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select count(*) from dba_jobs_running;
select count(*) from dba_jobs_running
ERROR at line 1:
ORA-00942: table or view does not existI've tried various other commands from that list and I get errors as well.
I'm not quite sure where to go from here to troubleshoot this problem. Any help would be appreciated. Thanks.
Edited by: 874375 on Jul 22, 2011 9:14 AM
Edited by: 874375 on Jul 22, 2011 9:18 AMSo I changed my script to this:
exec sys.dbms_scheduler.create_job( job_name => '"SYSTEM"."UCR"', job_type => 'EXECUTABLE', job_action => '%windir%\system32\cmd.exe /C D:\UserCountReport\bin\ucr.bat', ....I now have this:
SQL> SELECT JOB_NAME, status FROM DBA_SCHEDULER_JOB_LOG where job_name='BOXTONE_
MONTHLY_UCR';
JOB_NAME
STATUS
BOXTONE_MONTHLY_UCR
FAILED
BOXTONE_MONTHLY_UCR
SUCCEEDED
BOXTONE_MONTHLY_UCR
SUCCEEDED
JOB_NAME
STATUS
BOXTONE_MONTHLY_UCR
SUCCEEDEDIs there a place with log files that will tell me why the job failed? If so where are the log files located?
Maybe you are looking for
-
I'm a writer and I'm always out and about, when i get inspiration i write down a paragraph or two on my iPod, but then i have to re-write it again when i get home... Is there a notepad compatible app out there?
-
Questionnaire for Loyalty Management
HI Experts, I have created a Questionnaire for Membership Object. Now i need to store the questionnaire with link to the Membership Object. Also i need to show the Questionnaire Assignment Block for the membership Object (Component LOY102H_MSH) First
-
JFormattedTextField as custom cell renderer in JTable?
I have my custom renderers in my custom JTable that work quite good so far. After upgrading to JDK 1.4, i want to finally use formatted text fields in my JTable. So, i extended my renderes to also support formatters. But this doesn't seem to work. Th
-
I have a motion tween that goes from object A to object B, then C, D and finally E. How do I make the whole shooting match one big (small) movie? I've tried highlighting all the frames then pressing F8 but that doesn't seem to work (just makes the fi
-
Where is the SURFACE BLUR filter?
In Photoshop CS2, there is a surface blur filter. I need to use it now, but I can't find its plugin although I have Photoshop CS2 SDK now. Where can I call the "surface blur" function? Thank you!