Running SQL scripts on different databases

Hello!

At my work we have many databases on a server. I have to make a request so that users can run the application on a selected database SQL scripts.

So my question may be separated into 2 sections:

1 - is possible to let users SQL scripts run directly from the application?

I think a database to create a page that displays the list of all the SQL scripts, that we want to use, and when you click on a specific script name in the list, it asks something like "Where the database you want to run the script?", and then, as confirmed by the user, it would show results running the script on a different page.

is 2 - possible to let users choose what database to run these scripts?

Any information would be helpful, I'm at the beginning of the project and am not sure at all about how to proceed, or if it is at all possible.

Thank you!

Fallen_Kaede wrote:

Thanks for the quick response. I confirm that we are talking about databases on a server.

The request is to "debug" to other databases. For example, be run scripts to the locks on the list, to show the different indexes on a table, etc. to help diagnose problems.

It looks like the 'users' are DBA who should use OEM/Grid Control to do so.

1 - is possible to let users SQL scripts run directly from the application?

Lol the only way to run scripts in the APEX is the use of the SQL Scripts for SQL workshop component.

The key word in your question is 'application '. SQL * more and Developer SQL are applications that allow users to run SQL scripts on the desktop. Scripts SQL is an APEX integrated application that allows developers to run SQL scripts on the web. However, there is no documented way supported for end users to run SQL scripts in a custom of APEX application that you created. Therefore, rethink your approach. Rather than create an application APEX runs scripts, you must convert the scripts in PL/SQL, APEX packages, pages, components and applications leverage features of the APEX and reports, graphics and interactivity (e.g. exploration links; timed refreshes etc.). This will give you a user experience improved, beyond what is possible using static SQL scripts.

is 2 - possible to let users choose what database to run these scripts?

The APEX applications would exist on an instance of the APEX in a database and access other databases using the database links (which can have a performance impact). It would be possible to create a LOV based on the view of the USER_DB_LINKS dictionary and use in a selection set to a global page list to provide a control to set the current context of the database. Region data sources will have to be generated dynamically in the packages of PL/SQL use the links from relevant database based on this value LOV.

Tags: Database

Similar Questions

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • Run SQL scripts from a unix directory

    DB version: 11.2
    Version of the operating system: Solaris 5.10

    We have a set of scripts that are used by administrators to display the info of Tablespace free space, file size information... etc.

    Currently these .sql files (say free_Space.sql) are stored in the directory/U02/dba_scripts /. To run these scripts a dba can navigate to this directory, and then connect to sql * plus and from there run it as
    SQL > @free_Space.sql
    I recently came across an environment where you can connect to SQL * more than any directory and you can run scripts as above any directory. How is that possible? Should what settings I set for this?

    Herbaceous says:
    DB version: 11.2
    Version of the operating system: Solaris 5.10

    We have a set of scripts that are used by administrators to display the info of Tablespace free space, file size information... etc.

    Currently these .sql files (say free_Space.sql) are stored in the directory/U02/dba_scripts /. To run these scripts a dba can navigate to this directory, and then connect to sql * plus and from there run it as

    SQL > @free_Space.sql
    

    I recently came across an environment where you can connect to SQL * more than any directory and you can run scripts as above any directory. How is that possible? Should what settings I set for this?

    SQLPATH environment variable

  • How to run SQL scripts using OWB process flows?

    Hello
    I have a few SQL Scripts. I run them using process flow OWB.

    Can I get a document or a link that helps me to achieve this?

    Thanks in advance,
    SriGP

    Hi SriGP,

    You can call SQLPLUS using the external process activity.

    Order: Give the full path of the SQLPLUS executable
    Script: specify what you want to do in SQLPLUS

    Thank you
    Fati

  • running sql against a different schema in the same db

    Inside of the forms I need to check all other schemas to see if a record exists in any of the other patterns

    If im doing a loop based on a cursor to select all_users username and then, inside do something along the lines of

    Select the schema.table column where column = x

    I would normally run immediately via a new acquisition to do this, but it seems an exaggeration and I was wondering if there was built using the forms no.?

    I would do it using your 'overkill' method: create a function, pass in the column and tablename parameters (if necessary) and call the function in the form.

    My philosophy of development of forms is to put too much logic in the db and stored procedures, rather than in the individual shapes.

  • Where the SQL Scripts running after the installation of the ODAC for Oracle Client?

    I just installed ODAC for Oracle Client on a windows server that runs a database of sql server, allowing developers to connect to a web application to an Oracle/Unix database. The installation States to run SQL scripts, located in the $ORACLE_HOME\ASP.NET\SQL directory after installation. I don't know where to run them? On the ORACLE DB on the Unix server? If someone could let me know, I'd appreciate it. Thank you.

    You must run on the Oracle database server, but they are necessary only if you use Oracle for ASP.NET providers.

    If you just install the software, so you can use OLEDB with SQL Server linked server, for example, you don't need them. What do you need to run although if this is the case is the oramtsadmin.sql script that creates the objects used by the Oracle MTS Recovery Service (if you do not have these objects created on the database) that SQL Server uses a distributed transaction for Oracle connections I think.

    It will be useful,
    Greg

  • Red field when I try to run the script with 10G

    I recently installed 10G XE. I am able to create a new user and was trying to run a script for JustLeeBooks on the site of Thompson Course Technology books. I downloaded the files on my computer and then entered the new user and viewed and downloaded the script. The area where appears the script is all red. When I click on run, nothing happens. This script box are red like that?

    I can click on remove and delete the script, but I can't seem to run the script.

    What should I do to run the script for my database class?

    Thank you.
    Vicki

    Hello

    Pre installed Apex XE is quite old and does not take in charge all new browsers.
    Did you try to use other browsers?

    You can also upgrade Apex
    http://www.Oracle.com/technetwork/developer-tools/Apex/upgrade-Apex-for-XE-154969.html

    But be aware that you lose the database management features. But you can make those for example with the SQL Developer as above shows link.

    Kind regards
    Jari

  • Access 2003-> Oracle 10 g: fixed error of migration, SQL script

    I recently migrated an Access 2003 to SQL using Oracle SQL developer Oracle database, and the process went well, with the exception of some migration errors.

    The errors I had have largely brought on 3 main groups:

    (i) "doesn't have to convert' errors:
    Failed to convert view Q345_Delete_NR > filename. Q345 - Delete NR: unexpected node in the AST: EXEC_PARAM_LIST: column of the row-1-1

    (II) 'limitation of translation mistakes:
    Limitation of the translation "cannot convert to display" met on view filename. Q326 - update column of NA column_name line 0 0

    (III) "parse errors":
    oracle.dbtools.migration.parser.ext.ExtStringTemplate.setValue(ExtStringTemplate.java:106)

    I know that these can be fixed, but I'm unable to understand what they mean. I would be grateful for some advice on what this means and how do I address to them.

    Finally, I would like to watch the complete SQL script for the database migrated - please someone let me know how to consider this in a single sheet? I would like to create a stored procedure from this one.

    Thank you.

    Published by: 803242 on October 19, 2010 16:23

    As you have an Oracle database you currently have support for this database and this is quite enough to save a service request for the SQL Migration Workbench developer.
    Saving a service request will allow us to examine the migration of more detailed SQL Dev and then we can improve the product.

    (The stored procedures, you need to manually extract the instructions in the script generated) that you intend to do) and then put it in a procedure.

  • passage OEM "SQL Script" job name in lowercase as proxy database

    Hello

    I have a SQL script that requires the name of the database in lower case to be passed when running - she uses it as a substitution variable to create database directories that point to the UNIX file system (which is why they are case sensitive). I want to be able to configure this script as work in OEM (12 c version 3) so that I can run on several databases (11.2.0.3), but at the creation of employment, the % DBName parameter returns only the name of the database uppercase. I tried to change the % DBName parameter and run the script in a PL/SQL block, but the variable I spend it is interpreted as a literal string. I also tried to run in a shell script, but because of the way the user operating system is set up that I can't get that to work either.

    Does anyone have any ideas how this can be done? Ideally, I wish I could just run @script lower (%DBName%) or something similar.

    Thanks in advance,

    Robin

    In case anyone else has trouble with this, I worked on that I was able to use a PL/SQL block to convert the variable substitution for lower case, then create the directory with the variable:

    DECLARE

    v_lowerSID varchar2;

    BEGIN

    Select lower ('& 1') in the double v_lowerSID;

    run immediately ' create the db_dir as directory "/ [path] /' | v_lowerSID | '/' || v_lowerSID | ' _directory1 "';

    END;

    /

  • Backingup database using SQL script

    Hello

    Let me start by saying I am new to Oracle and I'm learning how to do a project where I have to write a SQL script that allows you to back up all data files (i.e. control, redo log and data files).  Assuming that all the files are stored in a folder, the source locations and the destination of these files must be provided as 'substitution variables.  The script must implement the following tasks (directions)


    1. Log in as the SYS user with SYSDBA role
    2. Closing the database
    3. Copy the files to the location of the source database and store it in the destination location
    4. Restart the database
    5. Log in the user SCOTT

    In addition, the script must use the "HOST" command to publish the operating system command to perform the copy task.


    * Since this is just a learning project and not a real scenario, I can't run my script in SQLplus to verify if it is correct. That's why I ask for professional advice. I am currently working with Oracle 11 g Enterprise running on a client Windows XP OS.


    Here's what I decided, it's a cold backup, please let me know if what I do is correct so far, and if not can you please steer me in the right direction.


    connect SYS / < password > have SYSDBA

    Shutdown;

    Copy of HOST of & source_file to & destination_file;       -It is the line that confuses me.

    connect SYS / < password > have SYSDBA

    start-up;

    Connect scott/tiger


    Thanks in advance for your time and input.

    I currently have the free version of 11g Oracle Enterprise downloaded on my computer, running on VB with the client Windows XP OS. But being new to this that I find myself afraid of bad script execution that can break my DB. I know that I can just reload and try again, but I try to approach the question as carefully as possible. Although the error codes help me understand what I am doing wrong much of the time.

    Break things (and their fixation) is how to learn.  Because you are running in VBox, simply take a snapshot of vbox system before testing.  So if it is irrevocably broken, you just restore the snapshot system.

    But give what you're trying to do, what do you think might happen this may break your db?  As far as the db is concerned, everything you do connect, stop and commissioning.  Nothing can go off of the truth of that.

  • Model reusable SQL Oracle to create a DDL/DML Scripts for Oracle database

    Hello


    I have an obligation to set up a model of Oracle SQL to create the Scripts DDL/DML reusable for Oracle databases.
    Only the Oracle DBA will run scripts permissions is not a problem.

    The workflow for any DOF is as follows:-

    (1) new table

    a. check whether the table exists in the views system/admin.
    b. If the table exists then give message "Table exists".
    c. If the table does not exist then run DDL code

    (2) add the column

    a. check if the column exists for a given table of the system/admin views
    b. If the column exists in the specified table.
    B1. backup table.
    B2. ALTER table alter column
    B3. check data or execute convert dml sauvegardΘ to the new change script.
    c. If the column does not exist
    C1. backup table
    C2. ALTER table add column
    C3. Run dml to populate the column with the default value.

    The DML scripts are to populate the base tables with the data required for business operations.

    (3) addition of new line

    a. check if the line exists by comparing the old values of each column with the new values to be added for the new record.
    b. If there is, to give message line is
    c. If not exists, add the new record.

    (4) update existing record (we createtime columns in these tables as well as changes can be tracked)

    a. check if the row exists using the primary key.
    b. If there is.
    B1. off the record by using the "active" column of the table
    B2. Add new record with the necessary changes.
    c. If does not exist, add the new record with the necessary changes.

    Could you please help with some ideas that can get this done with precision?
    I tried several ways, but I am not able to set up something that meets all the requirements.

    Thank you

    If it helps at all. Sometimes we have a requirement for a DDL statement to be rerunable and her only error if something completely unexpected happens.

    It's a little monstrous, but basically, we wrap all DDL in a dynamic statement and capture errors that would indicate that the DDL script has already been run:

    Here's a bit of a model:

    declare
       w_ddl varchar2(32767);
    begin
       begin
          --
          dbms_output.put_line('Creating table TABLE_NAME');
          --
          w_ddl := 'CREATE TABLE MY_SCHEMA.TABLE_NAME
                    ( COLUMN_1     DATE          NOT NULL
                     ,COLUMN_2  VARCHAR2(10)  NOT NULL
                     ,COLUMN_3  DATE
                    )';
           --
          execute immediate w_ddl;
          --
          dbms_output.put_line('Successfully created table TABLE_NAME');
          --
       exception
          when others then
             if sqlcode = -955 then
                dbms_output.put_line('Table Already exists.');
             else
                dbms_output.put_line('creation of table TABLE_NAME failed:');
                dbms_output.put_line(sqlerrm);
                raise;
             end if;
       end;
    
      begin
          --
          dbms_output.put_line('Creating unique primary key constraint for TABLE_NAME');
          --
          w_ddl := 'ALTER TABLE MY_SCHEMA.TABLE_NAME ADD (
                   CONSTRAINT TABLE_NAME
                   PRIMARY KEY
                   (TABLE_NAME_ID) USING INDEX)';
           --
          execute immediate w_ddl;
          --
          dbms_output.put_line('Successfully created primary key on TABLE_NAME_ID');
          --
       exception
          when others then
             if sqlcode = -02264 then
                dbms_output.put_line('constraint already exists.');
             else
                dbms_output.put_line('creation of primary key failed:');
                dbms_output.put_line(sqlerrm);
                raise;
             end if;
       END;   
    
    <>
    

    It works well with our scripts to autmoated and help us when we iterate through development and back in if needed test environments.

    In this way, we can add the DDL statements to the deployment script and run the script again without error to set the database to the State required without having to run the newly created statement only.

    Sometimes this approach translates into a creation followed a statement alter table statement to add a column, but the end result of the script is always the same, and the deployment script can be controlled at source between iterations of development that is without having to restore the ddl changes to test the modified DDL script.

    hope that gives you some ideas.

  • Unable to run the script in catsem11i.sql

    Hello

    I wanted to use Oracle 11 GR 2 Semantic Technologies to store the RDF files in the database.
    I read on the forum to activate the Sematic Technologies, I need to run the catsem11i.sql script.
    For some reason I'm not able to run the script.

    Here's what I did:
    I have connected to SQL as System and typed: *@C:\app\User\product\11.2.0\dbhome_1\md\admin\catsem11i.sql*

    Here's what I got:
    SQL > @C:\app\User\product\11.2.0\dbhome_1\md\admin\catsem11i.sql
    installation 11 RDF
    PL/SQL procedure successfully completed.

    No errors.
    +: script_name1: = dbms_registry.nothing_script +;
    *+
    ERROR on line 14:
    ORA-06550: line 14, column 22:
    PLS-00201: identifier 'DBMS_REGISTRY' must be declared.
    ORA-06550: line 14, column 5:
    PL/SQL: Statement ignored
    ORA-06550: line 15, column 22:
    PLS-00201: identifier 'DBMS_REGISTRY' must be declared.
    ORA-06550: line 15, column 5:
    PL/SQL: Statement ignored

    No errors.
    Modified session.

    SP2-1506: START, @ or @ command has no arguments
    SP2-1506: START, @ or @ command has no arguments

    Modified session.
    SQL >

    What I am doing wrong?

    I am a student and have very basic knowledge about Oracle.
    I am running Windows 7 (64-bit) Home Premium.

    Published by: Bonzo on 22 April 2011 22:43

    Published by: Bonzo on 22 April 2011 22:45

    Published by: Bonzo on 22 April 2011 22:46

    Published by: Bonzo on April 22, 2011 22:50

    Please connect as SYS instead of the system.

  • Execution of the SQL query through 2 different databases to Oracle

    Hi all

    In Microsoft SQL server, we can run on 2 different databases depending on the type of SQL query:

    Select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;

    Test1 and TEST2 here is 2 different databases.

    Can we do the same in Oracle?

    Of course you can do it.
    Create a [database join | http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_5005.htm] from DB1 to DB2.

    Grant select on the tables of the DB2 schema with which you want to connect.

    And then, you can you can query as

    select * from DB1schema.emp
    union
    select * from emp@dblink_name;
    
  • Please: sql script to remove all users without objects on all databases

    Hi *.

    I need a big help each of you please.

    I have many users who is not more work in our society. Some who receive objects are locked. There are a lot of users and many database servers. And it's that long to finish this work.

    That the why I need your help to give me Scripts anyone who falls all users who have not all objects in all databases on all the oracle Server.

    Und other to import all users of all users who still get items in a table. And I guess to do before Friday 03 July 09.


    Thank you very much in advance

    Sincerely your

    Ora_Genie

    >
    Vincent wrote:
    to give you all the users with no object.

    To simplify can run the script generated by
    >

    Hi Michaels,

    This may not work

    SQL> Create user michaels identified by michaels
      2  /
    
    User created
    
    SQL> SELECT 'drop user ' || owner || ' cascade;' stmt
      2    FROM all_objects
      3   Group BY owner
      4  Having Count(*) = 0;
    
    STMT
    -------------------------------------------------
    

    Maybe this,.

    SELECT 'drop user ' || a.username || ' cascade;' stmt
      FROM all_users   a
         , all_objects b
     WHERE a.username = b.owner(+)
       AND b.owner Is Null
     Group BY a.username
    

    Kind regards
    Christian Balz

    Published by: Christian Balz 07/02/2009 11:18

  • SQL script to update the Peoplesoft database information

    Hi all

    I'm a new DBA for a charity running both PS financials & HR which often must create test, training and instances of dev of our production environments. Doing so currently requires a number of manual steps to update the different nodes and paths to those required for the new instance, and naturally I did not become a DBA to do manual work ;-)

    I'm looking for these steps, but the schema PS script being what it is, I'm not having much joy to find where relevant data could be. If someone had a script to do something similar, or could point me in the direction of the tables, I would be extremely grateful. The kind of things that we currently do through the interface are:

    PeopleTools > Integration Broker > Configuration of integration > nodes
    PeopleTools > Security > security objects > Single Sign-on
    PeopleTools > Public Services > Administration > URL
    PeopleTools > Integration Broker > Configuration > Quick Setup > Integration Broker areas
    PeopleTools > Portal > node definitions
    PeopleTools > the Ren Server Configuration > Ren Server Cluster

    We are currently running MS SQL Server, but all the PL SQL scripts would be great - I just need to know what are the tables contain the data.

    Thank you very much


    Andy

    Well, it is very dependent on version Peopletools.
    An easy way might be to open the corresponding page that you speak, and then display the definition of page and the associated record. At least that is what I use to do.
    Then, update you the table background and see if she takes your new values.

    To be brief, here is an excerpt of these tables (non-exhaustive list, PT.48):
    Node of single sign - we built: pstrustnodes
    Scheduler process definition: ps_serverdefn
    Run the command: psprcsruncntl
    Message channels: pschnldefn
    The e-mail table of contents: psapmsgpub *, psapmsgsub *, psapmsgarc *.
    Definition of message node: psmsgnodedefn
    URL: psurldefn
    Definition of employment: ps_prcsjobdefn
    OPRID (e-mail address): psoprdefn
    ...

    Then fill out your own list with the method that I gave above.

    Nicolas.

Maybe you are looking for

  • 29 Firefox on one of my 3 PCs fails to sync?

    Have installed Firefox 29 on my 3 PCs (both Linux Mint 16, a Windows 8.1) and created a Firefox account. 29 Firefox on Windows for all three users and a Linux PC synch all data ok, but a Linux PC does not synchronize data. So far I have reset Firefox

  • Impossible to update 1telephone 6s or download apps

    I can't download the 9.3.1 update on my iPhone 6 s. I get the opinion of "software update failed". I tried several times and did a restart forced with no luck. In addition, for a month, I was unable to download all the apps from the App Store. My hus

  • Satellite L450 - 16Q - Cmos reset jumper

    I need a snapshop Description hence the CMOS reset is on this laptop battery is soldered to the motherboard. on other models of toshiba, I know that you can bypass two points to reset the cmos.Help, please. Thanks, Lee

  • Unable to activate windows xp on the old computer after reinstalling

    I am the resurrection a storage computer that was purchased in 2007 with Windows XP Home Edition.  I formatted the hard drive, because he had some problems before and reinstalled windows.  He now wants me to turn on, but when I use the phone service

  • error 1075 the dependency service does not exist or has been marked for removing windows xp

    The DHCP Client has stopped, but it is configured to start automatically.  When I try to reboot, I get the following message: error 1075 the dependency service does not exist or has been marked for deletion.  I need help to solve this problem.  Becau