Execute OLAP in SQLPLUS
Do anyone know that how to execute the following OLAP command in SQLPLUS ?
MAINTAIN time_dim DELETE '08/05/2006';
I encounter error when I execute the command in the following way, SQLPLUS prompt workspace object 08/05/2006 does not exist.
execute dbms_aw.execute('MAINTAIN aw_time_dim DELETE 08/05/2006');
How to solve it ? Thanks
Are you sure you're using two single quotes and not a double quote? (They're hard/impossible to tell apart on the forum). ie, there's a difference between '' and ". Double quotes in OLAP DML are a comment delimiter, so the error you're getting implies you're using double quotes rather than single.execute dbms_aw.execute('MAINTAIN aw_time_dim DELETE ''08/05/2006''');
Similar Messages
-
Hello!
Just upgraded from 10.2.0.4 64 bit Windows to 11.2.0.2 64 bit OEL it test environment. DB Compatibility = 11.2.
SQL> select comp_name,version,status from DBA_REGISTRY where comp_name like '%OLAP%';
COMP_NAME
VERSION STATUS
OLAP Analytic Workspace
11.2.0.2.0 VALID
Oracle OLAP API
11.2.0.2.0 VALID
OLAP Catalog
11.2.0.2.0 VALID
Problem 1: We had 2 AWs in PROD on 10.2.0.4.We can not open any of them in 10g mode.
Problem 2: When we are trying to create AW in 11G mode we receive this error: XOQ-00703: error executing OLAP DML command "(SYS.AWXML!R11_INITIALIZE_AW
We have tried to rerun xumuts.plb under sys.
Log contains following errors:
=============================================
BEGIN dbms_aw_build.build('EXPRESS', FALSE); END;
ERROR at line 1:
ORA-00600: internal error code, arguments: [xspg: RSALPAGE01], [8128], [], [],
ORA-06512: at "SYS.DBMS_AW_BUILD", line 107
ORA-06512: at line 1
BEGIN dbms_aw_build.build('AWMD', TRUE); END;
ERROR at line 1:
ORA-34738: A severe problem has been detected. Analytic workspace operations
have been disabled.
ORA-06512: at "SYS.DBMS_AW_BUILD", line 107
ORA-06512: at line 1
==========================================
and so on for each system AW
should we raise a SR or somebody has any idea?
Big thx in advance!
Regards,
Kirill
Edited by: Kirill on Jun 16, 2011 1:34 PMI think you should raise an SR on this issue.
-
i'm trying to execute the file sqlplus /nolog @statistics.txt <sapuser> as per the sap note 0001020260 ihow can i find the sapuser
KANNAN VENKATACHALAM wrote:
brconnect -u / -c -f stats -t all -- what it will do exactly ?
Would you mind to read the BR*Tools documentation?
it is located on the oracle community (same place as this forum) it is quite a big document.
AFTER you have read it, if you have any problem understanding what that command does exactly you are welcome to ask again -
Execute mapping thro sqlplus - parameters
Dear all,
I am new to owb
I have a mapping with two input parameters(MAPPING_NAME & MODULE_NAME), if i execute from control center it is executing
i want to execute it from sqlplus
the command i am using to execute from unix prompt is
sqlplus username/password@connectstring @/opt/oracle/product/10.2.0.1-OWB
/owb/rtp/sql/sqlplus_exec_template.sql repouser mapping_location PLSQL mappingname , MAPPING_NAME=mappingname,MODULE_NAME=HRMS
Log file after execution
Stage 3: Overriding Parameters
| MAPPING_NAME%CUSTOM='mappingname'
| MODULE_NAME%CUSTOM='HRMS'
Stage 4: Executing Task
| l_audit_result=3 (FAILURE)
Stage 5: Closing Task
Stage 6: Processing Result
| exit=3
how to give the mapping parameters
Thanks in advance
S. Sathish KumarFor string parameters In 10.2, you need to use four apostrophes on both sides.
sqlplus username/password@connectstring @/opt/oracle/product/10.2.0.1-OWB
/owb/rtp/sql/sqlplus_exec_template.sql repouser mapping_location PLSQL
mappingname MAPPING_NAME=''''mappingname'''',MODULE_NAME=''''HRMS'''' -
Executing proc from sqlplus.
Hi all,
can you please let me know how to run a procedure with an OUT paramater using sqlplus?
I ran from Toad and got the output..but not able to do so in sqlplus.
CREATE OR REPLACE PROCEDURE IDM.GET_CAP_DATE
CAP_DATE OUT VARCHAR2
) IS.....................................
I tried the following from sqlplus
variable CAP_DATE VARCHAR2(100);
exec GET_CAP_DATE;
print :CAP_DATE;
Am I right in doing this?
Appreciate your help!
Thanks in advance!
MNHi,
You're almost right, but you need to use your variable when executing your procedure:
exec GET_CAP_DATE(:CAP_DATE);
Infact you're better off using a function instead:
- procedure usually 'do stuff'.
- a function always needs to return a value.
MHO%xe> create or replace procedure get_date_proc
2 (p_date out date)
3 as
4 begin
5 select sysdate
6 into p_date
7 from dual;
8 end get_date_proc;
9 /
Procedure is aangemaakt.
MHO%xe> set autoprint on
MHO%xe> var my_date varchar2(25)
MHO%xe> exec get_date_proc(:my_date);
PL/SQL-procedure is geslaagd.
MY_DATE
10-09-2009 20:39:42
MHO%xe> create or replace function get_date_func
2 return date
3 as
4 begin
5 return(sysdate);
6 end get_date_func;
7 /
Functie is aangemaakt.
MHO%xe> select get_date_func from dual;
GET_DATE_FUNC
10-09-2009 20:40:13
MHO%xe> exec :my_date := get_date_func
PL/SQL-procedure is geslaagd.
MY_DATE
10-09-2009 20:40:34And don't use strings to store dates, always use the DATE datatype for DATES.
Never store a date in a string.
The function can be selected from DUAL easily (procedures cannot) and your DATE still is a DATE. -
I trying to get an explanation as to what is the difference between using semicolon or slash when running commands in sqlplus?
Thx.; - executes the command
/(slash) executes the command or block in the buffer and will not display the command.
SQL> select sysdate from dual;
SYSDATE
14-OCT-09
SQL> ;
1* select sysdate from dual
SQL> /
SYSDATE
14-OCT-09-Anantha -
Formatting output of execute plan in sqlplus
My execution plan looks ugly:
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=535 Card=1 Bytes=3
46)
1 0 SORT (ORDER BY) (Cost=535 Card=1 Bytes=346)
2 1 NESTED LOOPS (Cost=534 Card=1 Bytes=346)
3 2 NESTED LOOPS (Cost=516 Card=9 Bytes=2142)
4 3 HASH JOIN (Cost=156 Card=180 Bytes=23400)
5 4 TABLE ACCESS (BY INDEX ROWID) OF 'FND_LOOKUP_VALUE
S' (TABLE) (Cost=4 Card=2 Bytes=116)
6 5 INDEX (RANGE SCAN) OF 'FND_LOOKUP_VALUES_U1' (IN
DEX (UNIQUE)) (Cost=3 Card=2)
7 4 TABLE ACCESS (BY INDEX ROWID) OF 'PON_AUCTION_ATTR
IBUTES' (TABLE) (Cost=151 Card=312 Bytes=22464)
8 7 INDEX (RANGE SCAN) OF 'PON_AUCTION_ATTRIBUTES_U1
' (INDEX (UNIQUE)) (Cost=4 Card=624)
9 3 TABLE ACCESS (BY INDEX ROWID) OF 'FND_NEW_MESSAGES'
(TABLE) (Cost=2 Card=1 Bytes=108)
10 9 INDEX (UNIQUE SCAN) OF 'FND_NEW_MESSAGES_PK' (INDE
X (UNIQUE)) (Cost=1 Card=1)
11 2 TABLE ACCESS (BY INDEX ROWID) OF 'FND_NEW_MESSAGES' (T
ABLE) (Cost=2 Card=1 Bytes=108)
12 11 INDEX (UNIQUE SCAN) OF 'FND_NEW_MESSAGES_PK' (INDEX
(UNIQUE)) (Cost=1 Card=1)How can I format it to avoid wrapping? And is there a way to do it permanently (rather than just for one session) ?How can I format it to avoid wrapping?
COLUMN plan_plus_exp FORMAT a100
And is there a way to do it permanently (ratherthan just for one session) ?
Please read about [url
http://download-uk.oracle.com/docs/cd/B10501_01/server
.920/a90842/ch3.htm#1005634]SQL*Plus Configuration:
Site Profile in the manual.Thanks a lot. -
How to execute sqlplus command in bat file ?
Hello
I have a simple script file that looks like this:
"sqlplus admin/admin as sysdba
shutdown immediate"
But.. when i start this file.bat my system logs but do not make any script. Sqlplus just waiting for command, and when i write "exit" i logout from sqlplus, and then system execute next command, that is "shutdown immediate" but beyond sqlplus (so my base is still working). Is it at all possible to log on and execute commands from file.bat or some other way ?
I'm using oracle 11g, windows 7x64
Regards and thx for help
Edited by: 879529 on 2011-11-27 04:52969970 wrote:
Thank you that worked for me.But I fear you don't really understand WHY it worked, and WHY your first attempts did not work.
So let me explain
Given this .bat file
sqlplus / as sysdba
shutdown immediateWhat happens when you execute the file? The windows command processor reads the file line by line and processes the command on each line. What is the first lilne?
sqlplus / as sysdbaSo what would you expect to happen when Windows processes that line? Remember, it's exactly as if you had entered that command yourself at the command prompt .... Answer: The OS locates an executable file named 'sqlplus', loads it into memory and passes control to it, along with a pointer to the rest of the command line ('/ as sysdba'). At that point, the executable sqlplus has control and will do whatever it wants with the command line it was passed ('/ as sysdba') and then waits for user input for more commands, including an 'exit' command. Where are those commands going to come from? They are NOT going to come from the next line in the bat file. They can't. The command processor that is running the bat file is still waiting for sqlplus to finish and return control. So you are stuck. The only way out is to break out of sqlplus with a 'ctl-break'. Once that happens, the command processor moves on to the next line in the bat file:
shutdown immediateSo now the os tries to locate an executable file named 'shutdown' .... you probably don't have an executable by that name (let's hope not!) so you then get an error message from the OS informing you that
'shutdown' is not recognized as an internal or external command,
operable program or batch file.Now, if you were using a real OS, you could achieve what you wanted by using input redirection, but unfortunately, Windows just has a toy for a command processor. -
Need Help: Urgent:(sqlplus: cannot execute)
Hi,
This is the content in my .profile on a unix server,
MAIL=/usr/mail/${LOGNAME:?}
umask 027 #added by enRole Agent
PATH=${PATH}:/opt/app/p1crm1c3/informatica/oracle/product/10.2.0
export PATH
PATH=$PATH:/opt/app/p1crm1c3/informatica/oracle/product/10.2.0/network/admin/sqlnet.ora;export PATH
ORACLE_HOME=/opt/app/p1crm1c3/informatica/oracle/product/10.2.0
export ORACLE_HOME
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/bin
The paths are set correctly, however when i try to login to the server through the below line,
sqlplus username/password@oracleservername
ksh: sqlplus: cannot execute
It says, sqlplus cannot execute.. Please help me out with this! :( :(please execute: which sqlplus to see if you can reach sqlplus. probably you can, because otherwise the shell can not determine it can not execute.
execute: id to determine your current user and groups.
execute: ls -ls $(which sqlplus) to determine security settings of sqlplus.
my guess would be you are not allowed to execute sqlplus. -
Creating a Cube using pure OLAP DML
This should be quite simple, but neither reading OLAP_*.pdf nor googling helped me, so maybe you can give me a hint where to look:
I want to create dimensions, populate them, create a cube, and finally populate it, using just OLAP DML (i.e. no DBMS_AW or CWM/CWM2 packages).
1) How can I execute OLAP DML? Right now I'm using sqlplus, wrapping each line in execute dbms_aw.execute(...);
There's some better way, right? :)
2) Can someone give me a link to a simple tutorial, showing how to create a cube et c.? Right now I'm as far as
AW CREATE olaptest1
DEFINE dimfoo DIMENSION TEXT AW olaptest1
DEFINE dimbar DIMENSION TEXT AW olaptest1
SQL SELECT DISTINCT(foo) FROM footable ORDER BY 1 INTO :dimfoo
(the latter one fails, telling me that "quux is not a vaild olaptest1!dimfoo")
3) Have I understood this correctly: I only need an Catalog if I want to work with AWM or DBMS_AWM, not if I just use DML?I'm not sure exactly why you want to do this.
I guess I didn't explain very clearly :)
We (i.e. the company I work for) creates software (in C++) which needs to work with a lot of data which is in an Oracle-DB.
As the analysis done by the SW would profit (performance-wise) from the layout of the data in an cube, we want to get the data in a cube.
But information like the number of dimensions isn't known beforehand (as that's sth. that's dependent on the site the customer uses the SW on, and can
change with time), the software has to do the creation of dims and the cube itself.
(For the curious ones: http://www.centerpoint.eu.com/ )
And as OLAPI isn't available for C++ (at least afaics), I'd really want to do this in PL/SQL.
If you do use standard form, you then allow yourself the
option of using the various tools later
That's really not needed :)
You can always build the original AW using
AWM, then save the build script it generates, and use
that to do subsequent builds.
Is that build-script in OLAP DML? How do I save it?
BTW, in addition to the SPL INFILE command, there is
the DBMS_AW.INFILE plsql routine, which saves you
some quotes :-).
dbms_aw.execute('infile ''work_dir/my.inf''') vs
dbms_aw.infile('work_dir/my.inf')
I hate superfluous quotes :)
Thanks Jim! -
Bibean tutorial olap connection gives ora 942
Hi,
I'm working my way through the bibean tutorial.
I have not made much progress.
I'm stuck at the point where I create the BI Designer via wizard.
I'm seeing this error:
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oracle.express.ExpressServerExceptionError class: OLAPI
Server error descriptions:
INI: ORA-00942: table or view does not exist
in function: TxsRdbSelectStatement:execute(), Generic at TxsOqConnection::getDefaultDatabase
at oracle.olapi.metadata.BaseMetadataProvider.<init>(BaseMetadataProvider.java:68)
at oracle.olapi.metadata.mdm.MdmMetadataProvider.<init>(MdmMetadataProvider.java:127)
at oracle.express.olapi.data.full.ExpressDataProvider.getDefaultMetadataProvider(ExpressDataProvider.java:912)
at oracle.dss.metadataManager.server.drivers.mdm._92.MDMMetadataDriverImpl_92.getMdmMetadataProvider(MDMMetadataDriverImpl_92.java:1134)
at oracle.dss.metadataManager.server.drivers.mdm._92.MDMMetadataDriverImpl_92.attach(MDMMetadataDriverImpl_92.java:811)
at oracle.dss.metadataManager.server.drivers.mdm.MDMMetadataDriverImpl.attach(MDMMetadataDriverImpl.java:133)
at oracle.dss.metadataManager.server.MetadataManagerImpl.buildObjectModel(MetadataManagerImpl.java:1085)
at oracle.dss.metadataManager.server.MetadataManagerImpl.attach(MetadataManagerImpl.java:962)
at oracle.dss.metadataManager.client.MetadataManager.attach(MetadataManager.java:866)
at oracle.dss.metadataManager.client.MetadataManager.attach(MetadataManager.java:792)
at oracle.dss.addins.designer.OLAPSource.test(OLAPSource.java:280)
at oracle.dss.addins.wizard.connection.OlapTestPanel.testConnectionImpl(OlapTestPanel.java:49)
at oracle.dss.addins.wizard.connection.TestConnectionPanel$2.construct(TestConnectionPanel.java:180)
at oracle.jdeveloper.common.SwingWorker$2.run(SwingWorker.java:168)
at java.lang.Thread.run(Thread.java:536)
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
I used 'oemapp console' to look at my OLAP install.
It shows cubes and dimensions owned by BIBDEMO so I see some hope.
Here is info about my current setup:
Linux localhost 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production
Jdeveloper 9.0.3.1 build 1107
java version "1.4.1_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
Java HotSpot(TM) Client VM (build 1.4.1_03-b02, mixed mode)
Any of you have any clues for me?
Is it possible for me to connect to OLAP via sqlplus or pl/sql
so I can eliminate Jdeveloper, JDBC, and Java as suspects?
-atmhiAgain,
I made progress today by installing 9.2.0.1 general purpose DB and then upgrading it to 9.2.0.3.
Along the way I bumped into a bug with the DB:
20:47:04 SQL> alter user bibcat identified by bibcat default tablespace users;
alter user bibcat identified by bibcat default tablespace users
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-04045: errors during recompilation/revalidation of LBACSYS.LBAC_EVENTS
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 2
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 2
google told me this:
shutdown immediate;
startup migrate;
alter view lbacsys.lbac$all_table_policies compile;
alter package lbacsys.lbac_events compile body;
shutdown immediate;
startup;
Above commands ran okay for me.
then,
I ran rdbms/admin/utlrp.sql to recompile everything invalid.
results of this looked good too:
SELECT comp_name, status, substr(version,1,10) as version from dba_registry;
-atm -
How do i execute a stored procedure?
1. how can i see the list of stored procedures i might have in an oracle database from sqlplus?
2. say i could see a stored procedure called my_procedure, how can i see the code in this procedure?
3. how can i execute it from sqlplus?
thanks u very much.
- askerI ignore your statements fully. I have a joke here.
There is one fools' gang in a city and they want to prove that they are not fools. One of them says " If we can find the most intelligent man in the city, then we can no more be called fools." Then on one fine morning, one of the fools sets out on a search. He goes to a taxi-driver and asks him to take him to the most intelligent man in the city. Taking advantage, the taxi fellow roams around the entire city for the whole day and end of the day brings him to the same spot where he met him in the morning.
Taxi driver says, "Sir! I've not seen anyone who is more intelligent than me in this whole city. To prove this, I ask you a question and you answer me. If you can't answer me, then I'm the most intelligent in the city." Even the fool agrees on this and the Taxi driver continues saying, "We are four in our house. My mother, my wife, my son and who is the fourth one?". The fool couldn't answer that and the taxi driver says "The fourth one is me". the fool accepts his ignorance and sets off from the place to their fools-community gathering.
In the gathering, this folls explains other fools about his achievement and says that the taxi-driver is the most intelligent in the city. When other persons insist on how he had come that conclusion, he asks the same question to his community as says, "We are four in our house. My mother, my wife, my son and who is the fourth one?". The other fools fail to answer and ask for the answer excitedly. This fools replies, "The taxi driver".
In the same way as the fool, if I give direct answer to the question, the OP doesn't know the logic behind the answer and then just blindly remembers the answer rather than learning. That is the reason I insisted on doing some search before giving a solution.
Have a nice day ahead.
And yeah! Neither the number of posts not you can judge my skills. Rest of the community knows.
Cheers
sarma.
Added the bolded text.
Message was edited by:
Radhakrishna Sarma -
So I was asked to look into OLAP, and generating cubes for a reporting tool. I kind of came accross documents at both ends of the difficulty spectrum. Could someone tell me if I'm overlooking anything, because my initial attempts at generating cubes support the "simple" end.
The "difficult" instructions lead me to believe that in 10g there must be some default setup already in place, because the ROLLUP and CUBE functions already work.
Are there scalability issues that need looking into, or are ROLLUP & CUBE just variations on GROUP BY, and so the same issues apply?
Simple instructions:
http://oraclebizint.wordpress.com/2007/08/30/oracle-10g11g-olap-cube-and-rollup/
Difficult instructions:
http://www.dbazine.com/datawarehouse/dw-articles/rittman7
My test data & queries:
create table olap_test
(product varchar2(20),
color varchar2(10),
num_ordered number(6)
insert into olap_test values ('gum','blue',25);
insert into olap_test values ('gum','green',30);
insert into olap_test values ('chocolate','dark',1);
insert into olap_test values ('soda','yellow',1);
insert into olap_test values ('soda','yellow',1);
insert into olap_test values ('soda','white',1);
select product, color , sum (num_ordered)
from olap_test
group by rollup (product),
rollup (product,color);
select product, color, sum (num_ordered)
from olap_test
group by cube (product),
cube (product,color);Thanks,
--=ChuckThere is an OLAP option to the database. For an introduction to that option you may want to check out this information:
[OLAP and Data Mining|http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/bi.htm#sthref1954]
Brief Description:
The OLAP OptionThe OLAP option of the Oracle Database includes the following components:
* The OLAP analytic engine, which supports the selection and rapid calculation of multidimensional data within the Oracle Database.
* Analytic workspaces, which store data in a multidimensional format where it can be manipulated by the OLAP engine.
* Analytic Workspace Manager, a graphical user interface for creating and maintaining analytic workspaces.
* OLAP Worksheet, an interactive environment for executing OLAP DML, the data definition and manipulation language for interacting with analytic workspaces.
* Interfaces for developing OLAP applications in SQL and Java.
* OLAP Catalog, the metadata repository which represents a star schema as a logical cube. The OLAP Catalog enables OLAP applications to access relational data.
>
The ROLLUP and CUBE options are detailed in:
[SQL for Aggregation in Data Warehouses|http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#i1007462]
My understanding is that the OLAP option would be used in cases where you have significant quantities of data, or the answers to the questions are not known at time of coding (hence negates the ability of materialized views).
However in my experiences thus far all the capabilities identified in [SQL for Aggregation in Data Warehouses|http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#i1007462] has been able to answer all the questions I have needed. -
Olap script is missing after installation
Hello all,
We have Oracle 9.2.0.6 Enterprise Edition running on our Solaris8 server. Through our developers' request, I have installed 9.2.0.1 OLAP option on the database by choosing the Custom installation option and "Oracle OLAP" checkbox. After the installation, I patched it to 9.2.0.6 . However, I cannot find the "olap" script in its place, which is supposed to reside in /etc/init.d . Therefore cannot start the environment and so on.
I have also read the Metalink note 208335.1 but don't think I have done anything much different than it.
What might be wrong with the installation, has anyone ever experienced anything similar?
Kind Regardsnothing about /etc/init.d
I copied this from Note:177205.1 for you:
==========================================================
MANUAL INSTALLATION OF OLAP SERVICES DATABASE OBJECTS
Alternatively, you may install OLAP Services database objects manually by
running scripts, as follows:
First of all, you must already have installed Oracle JVM
objects. For instructions on how to do this manually, please see:
Note 149393.1 What scripts are needed to manually install Oracle9i JVM (9.0.1)
After performing the above, you will need to run the olap.sql script
while connected as SYSDBA, from SQL*plus :
1) First go to the olap/admin directory under the Oracle Home
cd $ORACLE_HOME/olap/admin
2) Run SQL*Plus and connect as sysdba:
sqlplus /nolog
SQLPLUS> connect / as sysdba
3) Run the oneinstl.sql and olap.sql scripts:
a) Refer to Note 208335.1 for running oneinstl.sql. Although it is written
for 9.2.0.1, the same applies for 9.0.1.
b) Use the following for running olap.sql.
You will need to provide the SID as a parameter to the script.
SQLPLUS> spool olap.log
SQLPLUS> @olap CWMLITE TEMP
SQLPLUS> spool off
SQLPLUS> exit
Review the olap.log spool file, there should be no errors.
4) You must verify that the OLAP Services folder /etc/OLAPServer has
been successfully created in the Oracle JVM. You may have to create
it manually on Windows NT.
Note 157822.1 contains instructions for this. -
ORA-27369 Exit-Code: 255 when executing sql script as job
Dear all
I'd like to find and compile all invalid objects in an instance. This should be done every day as a scheduled job with the use of DBMS_SCHEDULER.
For this, I set up the following sql-script:
---------start script--------------
set heading off;
set feedback off;
set echo off;
Set lines 999;
Spool /tmp/run_invalid.sql
select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
spool off;
set heading on;
set feedback on;
set echo on;
@/tmp/run_invalid.sql
exit
------ end script ----
The script ist working well when executed manualy via sqlplus. As you can see, it spools the commands to a second file (run_invalid.sql) which is the beeing executed to compile the invalid objects found.
I now want to schedule this script via DBMS_SCHEDULER (running the job every day at 7AM). Creation of the job:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'compile_invalid_objects',
job_type => 'EXECUTABLE',
job_action => '/home/oracle/scripts/sql/compile_invalid_objects.sql',
start_date => trunc(sysdate)+1+7/24,
repeat_interval => 'trunc(sysdate)+1+7/24',
enabled => TRUE,
comments => 'SQL-Script, und invalid objects zu finden und zu kompilieren'
END;
Manualy execute and error message:
BEGIN
DBMS_SCHEDULER.RUN_JOB (job_name => 'compile_invalid_objects',
use_current_session => true);
END;
FEHLER in Zeile 1:
ORA-27369: Job vom Typ EXECUTABLE nicht erfolgreich mit Exit-Code: 255
ORA-06512: in "SYS.DBMS_ISCHED", Zeile 150
ORA-06512: in "SYS.DBMS_SCHEDULER", Zeile 441
ORA-06512: in Zeile 2
--> Sorry for this, I'm using german localized oracle.
Unfortunately, it seems that only Shell-Scripts can be scheduled when using job_type='EXECUTABLE'. Can you confirm this?
BTW: The script is chmoded to 777, therefore it can't be a permission problem.
Is there maybe another solution with one single script using dbms_output functionality and run the script in a loop?
To complete my post, here are the commands used to create and test the job:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'compile_invalid_objects',
job_type => 'EXECUTABLE',
job_action => '/tmp/compile_invalid_objects.sql',
start_date => trunc(sysdate)+1+7/24,
repeat_interval => 'trunc(sysdate)+1+7/24',
enabled => TRUE,
comments => 'SQL-Script, und invalid objects zu finden und kompilieren'
END;
Thanks for your help
CasiYou could more simply use $ORACLE_HOME/dbms/admin/utlrp.sql
Maybe you are looking for
-
Photo image morphs into folder!
When i drag and drop a individual foto image from an album in iPhoto to another album in iPhoto, it turns into a whole new album instead remaining an individual image file. It worked fine until the last few days. Que paso?!
-
File Open/Save Boxes of SQL- Developer
I am not aware if these points are already discussed or on features list. 1) I could not find how to set default directory where SQL Developer will go directly when I am opening new file. 2. Also as far as I experienced SQL Developer does not remembe
-
I have been grading two films in Color, Shot in HDV, edited in HDV from FCP using multiclips (don't go there re Multiclips and color. Lots of prep needed before sending sequences to color) anyway. First film sent back to color no problem, second film
-
How do I redeem my MTN LION SINGLE UNIT LICENSE Redemption Code
How do I redeem My MTN LION SINGLE UNIT LICENSE Redemption Code?
-
Why is iTunes taking so long to transfer music files
HI all I've been waiting for an hour and a half to transfer 85 mp3 files.This can't be right.Any ideas