Running an SQL script in the background
Hi all,
I am executing a simple but long running script. Is there a possibility to have the script executed in the background so that I can close the SQL Developer with the script still being executed?
Thanks for your help,
Jan
Yes, but you'll have to schedule it using DBMS_SHEDULER or the older DBMS_JOB package. The latter is somewhat implemented inside sqldev, using the Jobs node.
Hope that helps,
K.
Similar Messages
-
Having problems trying to run a sql script using the command prompt.
I place my script at the root c:
open run SQL Command Line.
I connected to the database using connet userid/password
Then I tried to execute the script by doing
@test_add_comments
I am getting the error message.
SQL> @test_add_comments
SP2-0310: unable to open file "test_add_comments.sql"
Am I suppose to place this sql somewhere else?
test_add_comments.sql is
COMMENT ON COLUMN myTable.ID IS 'Primary Key' ;
COMMENT ON COLUMN myTable.REVIEWLOG_ID IS 'REFERENCE TO SAFE REVIEW LOG TABLE' ;
COMMENT ON COLUMN myTable.FAC_ID IS 'REFERENCE TO ALL FACILITIES' ;
COMMENT ON COLUMN myTable.HALLBUILD_ID IS 'REFERENCE TO HALL BUILDING' ;I figure it out.
open a sql worksheet and enter the falling commands in the run script.
@c:\your_script.sql
Execute it by clicking run script. -
Need to run a sql query in the background and display the output in HTML
Hi Guys,
I have a link in my iprocurement webpage, when i click this link, a query (sql query) should be run and the output should be displayed in a HTML page. Any ideas of how this can be done. Help appreciated.
We dont have OA Framework and we r using 11.5.7.
help needed
thanxRead Metalink Note 275880.1 which has the link to developer guide and personalization guide.
-
Silent installation then run a sql script
I'm trying to do a silent install of 10g on a windows server.
I have created the response file and it works correctly.
After the oracle software has successfully installed I want to run some sql scripts on the newly created database, how do I do this automatically?
I have tried to create a batch script to do it but because the setup command opens in a separate window it never returns back to the batch script to run the sql.
install.bat:
start /wait c:\oracle_software\database\install_oraclesw.bat
call run_sqlscripts.bat
pause
install_oraclesw.bat:
setup -silent -responseFile c:\oracle_software\database\response\standard.rsp -nowait
Thanks in advanceI'm doing a 10gr1 silent install and one problem I ran into was the setup executes when cause java, then it closes, so the next step in my script executed immediately.
I had to use the choice command to bring up a prompt to pause the script.
start cmd /c setup.exe -responseFile c:\stardard.rsp -nowelcome -silent
choice /C YN /M "Press Y if install completes successufully, else press N." -
How can I run a SQL script file...
How can I run a SQL script file from a location on my computer without providing the whole path?
Is there some way I can set a "Working folder" in SQL Plus??
Thanks!
TomYou can create an environment variable called "SQLPATH" which is a list of directories that SQL*Plus will search for your .SQL
scripts.
I would like to use another directory than the oracle/bin...
How can I do this ??
Hello,
U can do this by this way:
Save odm_script.sql file to the default Oracle
directory i.e. Oracle-Home/bin and Run following command
through SQL Plus.
SQL>@Script_Name
I hope this will resolve ur problem.
Regards,
Omer Saeed Khan. -
How to run a sql script in oracle forms
Hi,
For me there is an sql script. I need to run that sql script in forms.
Actually we will run that sql file in pl/sql developer by giving @and the file name.
But how to run that file in forms.
Can any one help on these.Which book I have to look.
ThanksActually there is a script files which will drop all the indexes and tables.
DROP querry will be there for each index and each table.
So I run the script all the indexes and all the tables will be deleted. So using forms I have to run that script.
Thanks -
How I run a shell script from the scheduler on 10.2.0.2.0 ?
Hello Oracle People,
I'd like to run a shell script from the Scheduler in my 10g database.
Right now it is a simple shell script.
Eventually it will wrap RMAN commands to back up my DB.
I wrote a simple pl/sql script to create a job:
-- cr_job10.sql
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'my_backup_job',
job_type => 'EXECUTABLE',
job_action => '/h/oracle/scripts/tst.sh',
start_date => '06-SEP-07 5.33.00PM US/Pacific',
repeat_interval => 'FREQ=DAILY',
end_date => '08-SEP-07 4.00.00PM US/Pacific',
enabled => TRUE,
comments => 'My Backup Job');
END;
I see no errors when I run the above procedure.
I checked DBA_SCHEDULER_JOBS and the job is in there.
The scheduler, though, errors out with an error which I see in a trace file:
/h/oracle/admin/orcl/bdump/orcl_j000_22396.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /h/oracle/product/10r2
System name: SunOS
Node name: sol
Release: 5.10
Version: Generic_118855-14
Machine: i86pc
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 15
Unix process pid: 22396, image: oracle@sol (J000)
*** ACTION NAME:(MY_BACKUP_JOB) 2007-09-06 17:33:00.175
*** MODULE NAME:(DBMS_SCHEDULER) 2007-09-06 17:33:00.175
*** SERVICE NAME:(SYS$USERS) 2007-09-06 17:33:00.175
*** CLIENT ID:() 2007-09-06 17:33:00.175
*** SESSION ID:(140.13520) 2007-09-06 17:33:00.175
*** 2007-09-06 17:33:00.175
ORA-12012: error on auto execute of job 53267
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
I googled on this:
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
Google returned only 1 hit.
There, I see some evidence that I need to configure something inside
of Oracle to run shell scripts from the scheduler, but possibly just
for machines running windows. I'm running Solaris.
Do any of you know what I need to configure inside of Oracle to
run shell scripts from the scheduler?
-OwenHello people,
I should have added this bit of information:
"The script runs fine from oracle's crontab."
"The script runs fine from a shell owned by oracle."
I'm getting responses telling me to check my env variables and permissions
which would be helpful to a UNIX novice.
I have a feeling that no one is using the scheduler to run RMAN scripts.
Tim Hall suggested I take a close look at these files:
$ORACLE_HOME/rdbms/admin/externaljob.ora
$ORACLE_HOME/bin/extJob
Currently I'm setup like this:
bash sol root /h/oracle/product/10r2/bin 31 #
bash sol root /h/oracle/product/10r2/bin 31 # ll $ORACLE_HOME/rdbms/admin/externaljob.ora
-rw-r--r-- 1 root dba 52 Sep 7 15:29 /h/oracle/product/10r2/rdbms/admin/externaljob.ora
bash sol root /h/oracle/product/10r2/bin 32 #
bash sol root /h/oracle/product/10r2/bin 32 # cat $ORACLE_HOME/rdbms/admin/externaljob.ora
# externaljob.ora
run_user = rman
run_group = rman
bash sol root /h/oracle/product/10r2/bin 33 #
bash sol root /h/oracle/product/10r2/bin 33 #
bash sol root /h/oracle/product/10r2/bin 33 #
bash sol root /h/oracle/product/10r2/bin 33 # ll $ORACLE_HOME/bin/ext*
-rwsr-x--- 1 rman dba 30388 Sep 21 2006 /h/oracle/product/10r2/bin/extjob*
-rwsr-x--- 1 rman dba 30392 Sep 21 2006 /h/oracle/product/10r2/bin/extjobo*
-rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc*
-rwxr-xr-x 1 oracle dba 300 Sep 21 2006 /h/oracle/product/10r2/bin/extusrupgrade*
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 #
On my system, the user 'nobody' has no shell so I cannot use nobody.
I created a user named rman:
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 # su - rman
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
$
$ id
uid=220(rman) gid=220(rman)
$
$
$ date
Fri Sep 7 16:30:03 PDT 2007
$
$
Jared points out that rman needs access to extproc:
$ ls -la /h/oracle/product/10r2/bin/extproc
-rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc
$
$
Here is a demo of rman running his script:
bash sol root /h/oracle/product/10r2/bin 35 # su - rman
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
$
$
$ ls
scripts
$
$
$ scripts/tst.sh
$
$
$ cat scripts/tst.sh
#! /bin/sh
/usr/bin/date > /tmp/tst.sh.out.txt 2>&1 &
exit 0
$
$
$ cat /tmp/tst.sh.out.txt
Fri Sep 7 16:31:23 PDT 2007
$
$ rm /tmp/tst.sh.out.txt
$
I am focused on this error:
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
And I am focused on this exit code: 274662
What does 274662 mean?
If the Scheduler gives me an error like "274662" rather than some English,
it's obvious to me the Scheduler is a POS and I should not use it.
And of course,
If I cannot run RMAN from Oracle Scheduler, I'll use cron.
-Owen -
Running OC4J on Linux in the background?
I am relatively new to Linux and have been trying to start OC4J either automatically or as a background process (so that I do not have to keep the terminal window open). I tried "$nohup java -jar oc4j.jar &", but OC4J still shuts down when I logout or exit the terminal. Does anyone know of a good way to start OC4J automatically or as a background process?
You've two choices:
- install public domain 'screen' program followed by
running oc4j in a 'screen' session and detach from
the 'screen'. BTW, 'screen' allows you to reattach
to an existing session of 'screen'
- Write a one line shell script and launch this script
in the background. Now when you exit from your shell
your oc4j will continue to run.
-Anantha- -
Running a SQL Script to Create an Object Type
When I do Database Development with JDeveloper and fellow the instruction at
http://www.oracle.com/technology/obe/obe1013jdev/dbdevelopment/obe_%20dbasedevmt.htm
and try to Running a SQL Script to Create an Object Type by Right-clicking emp_rec.sql in the editor and
choose Run in SQL*Plus > hrconn, the new Obuect type can not created. The screen flashs and I only got the
message
"Invoking SQL*Plus...
D:\oracle\product\10.2.0\db_1\BIN\cemutls.exe
hr@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SID=ORCL)))
@emp_rec.sql" and nothing else (No error like JBO-XXXXX).
Can anybody Help Me? Thanks a lot!
SID: ORCLHi Simon,
Having had a closer look at your original message it seems that rather than selecting the SQL*Plus executable in the directory you have managed to select the file 'D:\oracle\product\10.2.0\db_1\BIN\cemutls.exe'.
If you go to 'Tools | Preferences' and select the 'Database Connections' node and alter the 'SQL*Plus Executable' field to 'D:\oracle\product\10.2.0\db_1\BIN\sqlplus.exe' and then try again, this should then work.
Regards,
Lisa -
Hi everybody,
I installed AWM 11.1.0.7B and Oracle Database 11g software, version 11.1.0.6.0.
I am trying to install Sample Schemas & Code.
I got an error running global_11g_create_cubes.sql script that I downloaded from the http://www.oracle.com/technology/products/bi/olap/olap_downloads.html#software
Here is an error:
Begin installation
... deleting GLOBAL AW (if it exists)
... creating GLOBAL AW
begin
ERROR at line 1:
ORA-37162: OLAP error
XOQ-00506: Unable to parse XML string sent from the client to the server
ORA-06512: at "SYS.DBMS_CUBE", line 88
ORA-06512: at "SYS.DBMS_CUBE", line 134
ORA-06512: at "SYS.DBMS_CUBE", line 154
ORA-06512: at "SYS.DBMS_CUBE", line 144
ORA-06512: at "SYS.DBMS_CUBE", line 181
ORA-06512: at line 2
The following line in the script gives an error:
dbms_cube.import_xml('GLOBAL_INSTALL', 'GLOBAL_MV.XML');
Any help will be greatly appretiated.
Thank you.
- tI suspect the problem is that you are using an 11.1.0.7 client to access an 11.1.0.6 server. This configuration should work, but there was a bug at some point with new clients and old servers. In any case you would be advised to upgrade your server to either 11.1.0.7 or, at least, the latest 11.1.0.6 OLAP patch.
-
Error 45 Initializing In SQL*Plus When Running A Sql Script
Hi All
I have a daily scheduled jobs running on Windows server 2003 and 2008. Oracle Version :10.2.0.1 and 10.2.0.4
right now jobs are not even starting when i run them manually. Found the error Error 45 Initializing In SQL*Plus When Running A Sql Script.
it says Bug:3039738.
what is the solution to fix this Bug ?
thanks
Shawnuser9174724 wrote:
Hi
do you think the Problem is not with the script ?
when i run the job its reaching SQLPLUS and giving error
Error 45 Initializing In SQL*Plus When Running A Sql Script .
Server:windows 2003 and oracle version :10.2.0.1
CMD /C %ORACLE_HOME_PRIME%\bin\sqlplus.exe /NOLOG @ %xxxx_HOME%\DBA_Backup\BackupDo.sql testdb BackupFull
The above line does the following:
1) launches a command procesor
2) passes that command processor the following command line parms:
/C
(process the following command, then terminate)
%ORACLE_HOME_PRIME%\bin\sqlplus.exe
the launched processor will process the executable 'sqlplus.exe' found in the \bin subdirectory, found in the directory indicated by the environment variable ' ORACLE_HOME_PRIME'. The remainder of the command line will be passed to sqlplus.exe for interpretation and processing
/NOLOG
tell sqlplus to start up without trying to immediately log on to a database
typically used to indicate to sqlplus that the immediately following string names a file of sql and sqlplus commands to be processed.
%xxxx_HOME%\DBA_Backup\BackupDo.sql
tell sqlplus to execute the commands found in the file 'BackupDo.sql', found in the subdirectory DBA_Backup, found in the directory name by the environment variable 'xxxx_HOME'.
testdb
BackupFull
pass the values 'testdb' and 'BackupFull' to be used as values for substitution variables &1 and &2 in the file 'BackupDo.sql'
Script:
rmanbackup.rman
BACKUP AS COMPRESSED BACKUPSET DATABASE FORCE PLUS ARCHIVELOG;
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE DISK;
LIST BACKUP SUMMARY;
LIST BACKUP;
EXIT;I don't know what you expect of this. It is an rman script and we've seen no sign of an rman script being executed in any of what you've shown us. RMAN commands are processed by rman, not sqlplus.
Unfortunately, you didn't think showing us the contents of BackupDo.sql was of any value in finding out what your problem was.
Edited by: EdStevens on Jul 11, 2011 7:58 PM -
SCOM 2012 SP1 Update Rollup 5 - DB and DW SQL script and the Management Packs
Hi,
I am applying SCOM 2012 SP1 update rollup 5 from KB article : 2904680.
Step# 4 and 5 from the "Installation Information" sections says to run the SQL queries(UR_Datawarehouse.sql and Update_rollup_mom_db.sql) located at "%SystemDrive%\Program Files\System Center 2012 SP1\Operations
Manager\Server \SQL Script for Update Rollups\."
But I do not have "System Center 2012 SP1\Operations Manager\Server \SQL Script for Update Rollups\." folder location on my SCOM Management Servers. Similarly I do not have the MPs given in Step #6.
Can someone please let me know from where else can I get these SQL scripts and the MPs. What if I don't run these SQL scripts. Is that OK?You will find it on below path%SystemDrive%\Program Files\System Center 2012\Operations Manager\Server \SQL Script for Update Rollups\.
inside system center 2012 folder> search to Server folder and inside it you will find SQL Script
Please remember, if you see a post that helped you please click (Vote As Helpful" and if it answered your question, please click (Mark As Answer). -
How and where to run utlxplan.sql script?
Hi,
A basic question: where and how to run utlxplan.sql script? I'd like to know both in window and linux environment.
regards.....From sqlplus, you can connect as sys and run the utlxplan.sql. Then you need to grant privileges to other users and create synonyms...
-
Running a SQL Script during task sequence
We are about to roll out new workstations to our entire enterprise. With that rollout comes updated software. The primary application that our end users work with on a daily basis uses SQL Express 2008 R2. A challenge that we've come across
is with a SQL script that we need to run, after the workstation has joined our domain. I have created a batch file, and copied it to the same directory as the AddADGroup.sql script. I have created an application in SCCM to run the batch file and
SQL script. The following is the batch file:
@echo off
Set Path=%path%;C:\Program Files\Microsoft SQL Server\110\Tools\Binn
echo.
SQLCMD -S .\SQLEXPRESS -U sausername -P xxxxxxxxxxxxxxxxx -i AddADGroup.sql
echo.
What I need to know is how to get this batch file to run, and be successful (about 4000 times). Is running this batch file the best practice? If not, what is the alternative?
Thanks! NateHi,
The following blog describes that how to deploy bat and script by Packages.
SCCM 2012 – deploying bat files and scripts
(Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice.
Microsoft does not guarantee the accuracy of this third-party contact information.)
Best Regards,
Joyce Li
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
I am getting an error in "Step 2 - Setup or Remove Lync Server Components" of "Install or Update Lync Server System" step.
"An error occured while applying SQL script for the feature BackendStore. For details, see the log file...."
Additionally, all previous steps such as: Prepare Active Directory, Prepare first Standard Edition server, Install Administrative Tools, Create and publish topology are done without any errors. The user that I used to setup the Lync server is member of:
Administrators
CSAdministrator
Domain Admins
Domain Users
Enterprise Admins
Group Policy Creator Owners
RTCComponentUniversalServices
RTCHSUniversalServices
RTCUniversalConfigReplicator
RTCUniversalServerAdmins
Schema Admins
I have tried to re-install all the things and started to setup a new one many times but the same error still occurred. Please see the log below and give me any ideas/solutions to tackle this problem.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
Initializing DbSetupBase
Parsing parameters...
Found Parameter: SqlServer Value lync.lctbu.com\rtc.
Found Parameter: SqlFilePath Value C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup.
Found Parameter: Publisheracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group;RTC Local Administrators;LCTBU\RTCUniversalServerAdmins.
Found Parameter: Replicatoracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group.
Found Parameter: Consumeracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group;RTC Local Read-only Administrators;LCTBU\RTCUniversalReadOnlyAdmins.
Found Parameter: DbPath Value D:\CsData\BackendStore\rtc\DbPath.
Found Parameter: LogPath Value D:\CsData\BackendStore\rtc\LogPath.
Found Parameter: Role Value master.
Trying to connect to Sql Server lync.lctbu.com\rtc. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Validating parameters...
DbName rtcxds validated.
SqlFilePath C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup validated.
DbFileBase rtcxds validated.
DbPath D:\CsData\BackendStore\rtc\DbPath validated.
Effective database Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath.
LogPath D:\CsData\BackendStore\rtc\LogPath validated.
Effective Log Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\LogPath.
Checking state for database rtcxds.
Checking state for database rtcxds.
State of database rtcxds is detached.
Attaching database rtcxds from Data Path \\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath, Log Path \\lync.lctbu.com\D$\CsData\BackendStore\rtc\LogPath.
The operation failed because of missing file '\\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath\rtcxds.mdf'
Attaching database failed because one of the files not found. The database will be created.
State of database rtcxds is DbState_DoesNotExist.
Creating database rtcxds from scratch. Data File Path = D:\CsData\BackendStore\rtc\DbPath, Log File Path= D:\CsData\BackendStore\rtc\LogPath.
Clean installing database rtcxds.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RtcSharedDatabase'****
Initializing DbSetupBase
Parsing parameters...
Found Parameter: SqlServer Value lync.lctbu.com\rtc.
Found Parameter: SqlFilePath Value C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup.
Found Parameter: Serveracct Value LCTBU\RTCHSUniversalServices;RTC Server Local Group.
Found Parameter: DbPath Value D:\CsData\BackendStore\rtc\DbPath.
Found Parameter: LogPath Value D:\CsData\BackendStore\rtc\LogPath.
Trying to connect to Sql Server lync.lctbu.com\rtc. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Validating parameters...
DbName rtcshared validated.
SqlFilePath C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup validated.
DbFileBase rtcshared validated.
DbPath D:\CsData\BackendStore\rtc\DbPath validated.
Effective database Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\DbPath.
LogPath D:\CsData\BackendStore\rtc\LogPath validated.
Effective Log Path: \\lync.lctbu.com\D$\CsData\BackendStore\rtc\LogPath.
Checking state for database rtcshared.
Reading database version for database rtcshared.
Database version for database rtcshared - Schema Version5, Sproc Version 0, Update Version 1.
Thanks and Regards,
Thanh LeThanks Lạc
Phạm 2
I Had similar issue i end up uninstalling and reinstallting but same issue, then i change the drive but same issue. It was I/O issue. After adjusting my I/O it fix our issue and installation went on without any issue.
If any one using KVM here is detail article
We just give this option cache=‘writeback
using this article http://www.ducea.com/2011/07/06/howto-improve-io-performance-for-kvm-guests/ and http://itscblog.tamu.edu/improve-disk-io-performance-in-kvm/ this fix my issue thanks
Maybe you are looking for
-
0FI_AR_4 extraction problem
Dear all, I use 0FI_AR_4 to extract AR data from R3 to BW. From R3 side, I use RSA3 to find the number of records of 0FI_AR_4 is 1460. However, when I initial uploaded content of 0FI_AR_4 into BW, I found only 1457 records loaded. Where is those t
-
Scheduling multiple tasks dynamically
Hi ! I'm working on schedulers. My problem is I have a list of dynamically generated reports.For every report that is generated , a corresponding scheduler must run periodically say , every day at certain time. The time at which the scheduler must ru
-
Transfer from ipad to laptop help please
How do i get all my music and photos from ,my ipad to my laptop. My hard drive on my lap top died and been replaced. I had backed up to iclouds on my ipad. How can i get everything back? If i sync it will wipe
-
Hello Everyone, i have doubt in deadline monitoring.can anyone of you tell me please what is the use of deadline data tab situated before outcome tab in test workflow window?
-
BAPI to update Employee position?
Hi All, what is the BAPI to update an employee's job title/position. Thanks Thruna Moderator message: please (re)search yourself before asking. Edited by: Thomas Zloch on Nov 4, 2010 10:51 PM