Calling set of sql scripts within a sqlscript

Hi i tried running set of scripts as follows
SQL>@c:\c1 which connects to the DB
and i have two more scripts within c1 as follows
connect usrname/pwd
@c:\i1
@c:\i2
exit
While running this i get the following error
SP2-0310: unable to open file "@c:\i1.sql"
SP2-0310: unable to open file "@c:\i2.sql"
however if i run as SQL>@i1 SQL>@i2 my execution seems to be fine, it errors out if i wrap it into c1 as mentione above, am i doing something wrong or missing something.

I see that in your script you run @c:\i1 and in SQLPlus you run SQL>@i1. What happens when in SQLPlus you run SQL>@c:\i1.
I see that you are working on Windows. Usually the starting directory for SQLPlus on Windows is $ORACLE_HOME\bin and not c:\.

Similar Messages

  • Calling a PL SQL script

    Hi, is it possible to call a pl sql script from within another pl sql script. I wanted to created a function or a procedures but turns out that I'm not allowed to in my organization.
    Thank you

    SeanMacGC wrote:
    BluShadow wrote:
    I take it your organization doesn't expect you to do much work then. What a stupid limitation.All in the name of 'Database Independence' or to be 'Database Agnostic' no doubt, the first to put humans on Mars they won't be! ;-)LOL!
    All attempts I've ever seen by people to write completely generic solutions (whether database generic or application generic) have resulted in unmaintainable code that performs slower than you could do it by hand).

  • Passing variables to a SQL script within GC

    Does anyone know if it is possible to pass in a variable to a SQL script job within Grid Control? I don't see that I can but I wanted to ask a larger group before cloing the loop on this.
    For example, I have a few different databases which contain schemas which contain date-range daily partitioned tables. I have a single code block which normally accepts the table_owner as a variable then loops through to analyze the current day partition. I'd love for OEM to be able to have the job submitted to different database targets whilst passing in a different schema name.
    Thank you in advance!

    This can be done in two steps, but first create a table containing 1 field in all the target databases (something like table_owner) you want to analyze. Before running the analyze script change in all the to be analyzed databases the table_owner (as a job?). Then run the analyze script that contains a statement that first reads the table_owner and use this table_owner as the variable you want.
    Even more simple would be to use a database link from the to be analyzed db's to a central db so you only have to change the table_owner in one table.
    Eric

  • SQL script within my query

    I'm in dire need for some help. I'm creating a report in Oracle Reports Builder 10.1 and I'm having some issue with retrieving data with the script I wrote. The report I have is filitered by cont_type = 'SC'. One field that I am trying to get has a cont_type of something other then SC or it is NULL. That field is called revised amount. I want to be able to see the results for the revised amt field (revised_amt) even though i'm filitering them out. Is there a way to do that? The other part to it is that the revised amt field will need to be summarized and reset after each contract #. For example...
    Contract #_______Contract Amt_____Revised Amt
    1455-001-SC_____1,023,560.00
    1455-002________________________56,236.00
    1455-003________________________789,653.00
    1356-001-SC_____23,563,566.00
    1356-002________________________25,666.00
    1289-001-SC_____5,222,659.00
    1289-002________________________15,456.00
    1289-003________________________123,456.00
    So for the end result i would like to see the totals of the revised amount for each contract #. It would look something like this
    Contract #______Contract Amt______Revised Amt
    1455-001-SC_____1,023,560.00______845,889.00
    1356-001-SC_____23,563,566.00_____25,666.00
    1289-001-SC_____5,222,659.00______138,912.00
    I'm new to SQL so please be patient with me. Thanks!
    This is my SELECT statement below. Just to clarify, sccont_cont_code's format is 0033-0001. I have to concatenate the '9' onto the beginning of it because the cont_codes have a 9 in front. I apologize in advance for my limited knowledge of SQL and PL/SQL. I am in the process of learning it as we speak. I'm being put into a tough position in my current job and in order for me to succeed I must learn this valuable tool. I appreciate any help for yall and maybe a possible tip here and there. Thanks again!
    SELECT '9' || sccont_cont_code, NVL(sccont_cont_amt, '0.00'), fl2030_ven_bp_name, fl2030_job_code, fl2030_job_name, NVL(sccont_hldbk_amt, '0.00'), NVL(sccont_bill_amt, '0.00'), NVL(sccont_paid_amt, '0.00'), sccont_chg_amt
    FROM flpm2030_v
    ,sccont
    WHERE fl2030_job_code = sccont_job_code
    AND fl2030_comp_code = sccont_comp_code
    AND fl2030_chg_code = sccont_chg_code
    AND fl2030_ven_code = sccont_ven_code
    AND fl2030_comp_code != 'ZZ'
    AND fl2030_cont_type LIKE 'SC'
    ORDER BY fl2030_ven_bp_name
    Edited by: House on Jul 22, 2010 1:44 PM

    So for the end result i would like to see the totals of the revised amount for each contract #. It would look something like this
    Contract #______Contract Amt______Revised Amt
    1455-001-SC_____1,023,560.00______845,889.00
    1356-001-SC_____23,563,566.00_____25,666.00
    1289-001-SC_____5,222,659.00______138,912.00  Hello,
    If you looks for the above result, then you can try with below code
    SELECT SUBSTR(CONT_NO,1,4), SUM(CONT_AMT),SUM(REVS_AMT) FROM TBLCONTRACT
    GROUP BY SUBSTR(CONT_NO,1,4)and in order to get the main contract number, you can write a function in report, which will accept the first 4 digit of the contract number and return the concatenation string of -001-SC. Hence this function output you can use as the first column value
    If my post is helpful mark accordingly.
    Regards
    Manoj
    Edited by: ManojP on Jul 23, 2010 7:41 AM

  • Replace Text In SQL Scripts

    Hi,
    I would like to search and replace text in files when I run .sql files.
    E.g. When user provide scripts xyz.sql, they would put table name like
    INSERT INTO  xyz abc VALUES ('text');I would like to replace xyz abc with mytablename.
    INSERT INTO  mytablename VALUES ('text');Besides, from the user provided sql scripts, they would be some junk create table scripts, I would like to comment off these junk table scripts.
    How could I do achieve the above?
    I would be calling user provided sql scripts from my sql scripts using @ ./data/temp.sql
    I am using oracle 8i for these. Any help is highly appreciable.
    Regards

    Sorry for not providing enough information.
    Oracle Version as follows:
           Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
         PL/SQL Release 8.1.7.4.0 - Production          OS:
    Windows XP SP2
    damorgan wrote:No clear description of what you are actually trying to do ... for example where does "mytablename" come from, where does "xyz" come from, how is the decision to be made? Based on what logic?
    These scripts are provided by customers where they use other database like sysbase to generate sql scripts and customers are not in a position to change or alter the scripts as these scripts are part of the solution provided by vendors(legacy systems)
    I have mapping sql script where table name is e.g. xyz abc then use script TS2 and process the customer given sql script.
    Let me know if I am missing out any other information.
    Regards

  • 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)

  • Calling sql script in a folder

    Hi All,
    I'm calling a SQL script from a root SQL script which is present in a sub folder.
    root.sql
    Prompt Loading FULL_RECOMPILE.SQL
    SET DEFINE OFF
    @@Utils\FULL_RECOMPILE.SQL
    SET DEFINE ON
    Show errors
    commit;When I run the script I'm getting the following error.
    SP2-0310: unable to open file "UtilsFULL_RECOMPILE.SQL".
    I tried using forward / (@@Utils/FULL_RECOMPILE.SQL) and the script executed succesfully.
    Is there anyway I can execute the above script by using a backward slash?
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    Thanks,
    guru
    Edited by: guru on 30-Jun-2010 05:54

    Your requirement seems to be executing the script present in the path:
    *./Utils/FULL_RECOMPILE.SQL*
    Is there anyway I can execute the above script by using a backward slash?Whats the need for using a backslash? Unix paths are separated by forward slash in contrast to windows.

  • SQL script calling HOST

    Hi, all. We've got a SQL script that will call the HOST and pass some parameters. One parameter, JOB_TYPE is set from a function call. The other variables are passed into the SQL script as parameters and they work fine. However, the JOB_TYPE variable's value is not being passed to the shell script,
    JOB_TYPE := f_get_job_type(person_id);
    --host $MY_HOME/mods/general/myjobs.shl &chain JOB_TYPE &username &pw &one_up &printer &special_print ""
    It thinks that we're passing the actual string "job_type" in. We've tried using "&" but that doesn't work either. Your help is appreciated.

    SQL> var jobtype number
    SQL> exec :jobtype := power(2,10)
    PL/SQL procedure successfully completed.
    SQL> col :jobtype new_v jobtype
    SQL> select :jobtype from dual;
      :JOBTYPE
          1024
    SQL> host echo hello &jobtype
    hello 1024

  • Trouble calling .sql script

    I have looked on the forum for about a half an hour and can't find the exact answer I'm searching for, so here goes.
    I'm trying to update about a 100 records or so through use of an .sql script.
    I put the following in my sql script file
    UPDATE TABLE1 SET COL_NAME1 = 'some val.', COL_NUM_VAL = 12345, BOOL_VAL_COL = -1
    WHERE AUTOID = 9554 OR AUTOID = 1082
    OR AUTOID = 1305 OR AUTOID = 133
    OR AUTOID = 9124
    OR AUTOID = 8712
    OR AUTOID = 55 OR AUTOID = 6741 OR AUTOID = 9881
    OR AUTOID = 1012 OR AUTOID = 9158 OR AUTOID = 9378
    OR AUTOID = 9101 OR AUTOID = 8351 OR AUTOID = 7110 OR AUTOID = 922 OR AUTOID = 732
    OR AUTOID = 7253 OR AUTOID = 7825 OR AUTOID = 6772 OR AUTOID = 9854;
    commit;however, I get some kind of message back in the SQL Plus prompt showing.
      8  OR AUTOID = 9101 OR AUTOID = 8351 OR AUTOID = 7110 OR AUTOID = 922 OR AUTOID = 732
      9  OR AUTOID = 7253 OR AUTOID = 7825 OR AUTOID = 6772 OR AUTOID = 9854
    10* commit;
    11  /I can't really discern from this output stmt what happened or what is wrong,
    and needless to say, the update query doesn't execute. Any ideas as to what I need to put in there? And can't I just open it up in SQL Plus after I've created the sql file?Or is there more to it than that?
    I welcome any feedback.
    Thanks!
    Message was edited by:
    user515689

    Hi,
    If you have a file called foo.sql that contains just the 10 lines of code that you posted, then you can run it from SQL*Plus by saying "@foo" (depending on where foo.sql is stored. You may actually have give the full path name: e.g.
    SQL> @c:\my_folder\sub_folder\fooWhat are you doing to run the script?
    By the way, instead of all those ORs you can use the IN operator:
    UPDATE TABLE1 SET COL_NAME1 = 'some val.', COL_NUM_VAL = 12345, BOOL_VAL_COL = -1
    WHERE AUTOID IN (9554, 1082, 1305, ..., 9854);

  • Not able to call sql script from shell program

    Hi Gurus,
    I am facing issue while calling sqlplus script from my shell program. Please find below my shell script. This program I've written and registered as for one of concurrent program
    in oracle applications.
    p_userid_passwd=$1
    p_appl_login=$2
    p_user_name=$3
    p_request_id=$4
    v_conc_request_id=${5}
    p_to_role=${6}
    p_from_role=${7}
    p_subject=${8}
    p_body=${9}
    p_dist_list=${10}
    v_request=${11}
    v_file_path_name=/u01/oraspt/REQUEST
    cd $APPLCSF/$APPLOUT
    echo "v_conc_request_id" $v_conc_request_id
    echo "p_to_role" $p_to_role
    echo "p_from_role" $p_from_role
    echo "p_subject" $p_subject
    echo "p_body" $p_body
    echo "p_dist_list" $p_dist_list
    echo "v_request" $v_request
    ls -l $v_request
    if [ $? -ne 0 ]
    then
       echo "No output request generated"
    else
       echo "Output request generated" 
    fi
    echo "connecting to ftp for placing out file to DB server"
    echo FTP to 99.60.17.11
    echo username: "oraspt"
    echo pw:        
    ftp -i -n 99.60.17.11 << EOF2
    user "oraspt" orakdk
    cd $v_file_path_name
    put $v_request
    bye
    EOF2
    output=`sqlplus -s /nolog <<EOT
    whenever sqlerror exit failure;
    connect  apps/apps
    set verify off;
    set serveroutput on size 120000;
           DECLARE
             l_errbuf      varchar2(300);
             l_retcode     varchar2(300);
           BEGIN      
            XXFND_SEND_MAIL.SEND_NOTIFICATIONS(  errbuf        => l_errbuf
                                               , retcode       => l_retcode
                                               , p_request_id  => $v_conc_request_id
                                               , p_to_role     => $p_to_role
                                               , p_from_role   => $p_from_role
                                               , p_subject     => $p_subject
                                               , p_body        => $p_body
                                               , p_dist_list   => $p_dist_list);
         EXCEPTION
            when others then
               dbms_output.put_line('Error encountered :'||SQLERRM);
         END;    
    EOT
    `
    echo "connecting to ftp for deleting output file"     
    echo FTP to 99.60.17.11
    echo username: "oraspt"
    echo pw:        
    ftp -i -n 99.60.17.11 << EOF2
    user "oraspt" orakdk
    cd $v_file_path_name
    delete $v_request
    bye
    EOF2
    echo "Deleted successfully"Output for script is as below
    v_conc_request_id 451906
    p_to_role DC.DKHOO
    p_from_role DC.DKHOO
    p_subject Receivable audit report10
    p_body Please find Audit Report Attachment.
    p_dist_list
    v_request o451906.out
    -rw-r--r-- 1 applspt dba 2368 Dec 28 15:06 o451906.out
    Output request generated
    connecting to ftp for placing out file to DB server
    FTP to 10.60.17.11
    username: oraspt
    pw:
    connecting to ftp for deleting output file
    FTP to 10.60.17.11
    username: oraspt
    pw:
    Deleted successfullyPlease let me know how to trigger pl/sql script.
    Thanks in advance for your help.
    Regards
    Nagendra
    Edited by: 838961 on Dec 27, 2011 11:25 PM

    Please find output as suggested, I've placed set -x in script.
    + p_userid_passwd=APPS/APPS
    + p_appl_login=1110
    + p_user_name=DC.DKHOO
    + p_request_id=451949
    + v_conc_request_id=451945
    + p_to_role=DC.DKHOO
    + p_from_role=DC.DKHOO
    + p_subject=Receivabless
    + p_body=report
    + p_dist_list=
    + v_request=o451945.out
    + v_file_path_name=/u01/oraspt/REQUEST
    + cd /u01/applspt/inst/apps/SPT_nfs-stg-app1/logs/appl/conc/out
    + echo v_conc_request_id 451945
    v_conc_request_id 451945
    + echo p_to_role DC.DKHOO
    p_to_role DC.DKHOO
    + echo p_from_role DC.DKHOO
    p_from_role DC.DKHOO
    + echo p_subject Receivabless
    p_subject Receivabless
    + echo p_body report
    p_body report
    + echo p_dist_list
    p_dist_list
    + echo v_request o451945.out
    v_request o451945.out
    + ls -l o451945.out
    -rw-r--r-- 1 applspt dba 2368 Dec 28 15:54 o451945.out
    + '[' 0 -ne 0 ']'
    + echo 'Output request generated'
    Output request generated
    + echo 'connecting to ftp for placing out file to DB server'
    connecting to ftp for placing out file to DB server
    + echo FTP to 10.60.17.11
    FTP to 10.60.17.11
    + echo username: oraspt
    username: oraspt
    + echo pw:
    pw:
    + ftp -i -n 10.60.17.11
    ++ sqlplus -s /nolog
    + output=Connected.
    + echo 'connecting to ftp for deleting output file'
    connecting to ftp for deleting output file
    + echo FTP to 10.60.17.11
    FTP to 10.60.17.11
    + echo username: oraspt
    username: oraspt
    + echo pw:
    pw:
    + ftp -i -n 10.60.17.11
    + echo 'Deleted successfully'
    Deleted successfully

  • Calling a sql script file from a function.

    Hi,
    I need to call a sql script file from a user defined function. Currently i am trying to do this in Oracle SQL Developer. i tried calling with
    @ {filename}, EXECUTE IMMEDIATE etc, but nothing worked. I get the Compiler error.
    Basically my need is to call catldap.sql file so that DBMS_LDAP package gets loaded and then I can call the API functions from this.
    Please let me know if this is possible doing in a PL/SQL function.
    thanks,
    Naresh

    user784520 wrote:
    I need to call a sql script file from a user defined function. Not possible.. and it seems that you do not fully understand the client-server within the Oracle context.
    All SQL and PL/SQL are parsed and executed by an Oracle server process. The SQL and PL/SQL engines each expects a single command block at a time. Neither of these can accept a series of separate commands as a single call and then execute each in turn. The SQL engine expects a single SQL statement at a time. The PL engine expects a single PL/SQL anonymous block at a time.
    This server process also cannot break into the local file system to access script files. Nor can it hack across the network to access script files on the client.
    In order for the server process to access local files, a directory object needs to be created and the current Oracle schema needs read and/or write access on that directory object. As sound security principles apply.
    There's no PL/SQL command to execute a script. You must not mistake SQL*Plus commands (this client has a very limited vocabulary) with PL/SQL commands. SQL*Plus executes its own commands.. and send SQL and PL/SQL commands (a statement block a time) to the Oracle server process to be serviced and executed.
    It is also a very bad idea to execute external script contents from inside an Oracle server process - as that script resides externally and thus outside Oracle's security mechanisms. This means that is is pretty easy for someone to access that script, compromise it, and then have you inject and execute the contents of that script into the database.
    It is not sound security.
    Last issue - it is even worse to have application PL/SQL code dynamically creating (or trying to create) portions of the Oracle data dictionary and PL/SQL call interface.
    The database needs to be installed correctly - and this includes loading and executing the required rdbms/admin scripts during database installation. It does not make sense at all for application code to try and execute such scripts. It raises numerous issues, including having to allow that application code full and unrestricted SYS access to the database instance. A very serious security violation.
    I do not agree at all with the approach you want to use.

  • How to call SQL script from PL/SQL block

    Hi All,
    I have a pl/sql block from which i need to call a *.sql script file.
    Please tell me that how can i do this?
    Thanks and Regards.

    > Though just for knowledge sake, would you please tell if there is a way
    to call a sql script from a pl/sql block.
    This question stems usually from a confusion about client-server and which is which in Oracle.
    SQL*Plus is a client. PL/SQL is a server side language. SQL is a server side language.
    When entering either one of these two languages in SQL*Plus (or TOAD, SQL-Developer, etc), the content is shipped to an Oracle server process, is parsed there, and is executed there.
    The Oracle server process servicing the client can accept a single SQL statement or PL/SQL block at a time.
    It cannot accept a block of SQL statements delimited with a semicolon. That is a client concept where the client will read each delimited statement and send that, one after the other (in synchronous call mode) to the Oracle server for execution.
    The Oracle server does not have a "script parser". It understands SQL. It understands PL/SQL. And that is what it expects from the client.
    Whether the client supports the SET command, the HOST command, SPOOL command, ability to run scripts, and so... have no bearing on what the server itself is capable of doing. The server does not care what feature set the client has. It is tasked with servicing the client via SQL and PL/SQL.
    It is not tasked to support or emulate client features like running SQL scripts.
    Nor confuse PL/SQL with the very limited command set of SQL*Plus. The two has nothing in common. And just as PL/SQL cannot understand C# or Delphi commands, it cannot understand SQL*Plus commands.

  • Error when calling a stored procedure from a SQL Script

    Apologies if this is a really dumb question but I can't seem to call a procedure in package from a SQL script. I have a simple package.procedure containing a loop to populate a table. I would like to include a call to this procedure from my database install script, that also includes my CREATE and INSERT statements. I run the script using "@install_databae" and the CREATE and INSERT statements run fine. The script gives an error when it reaches the line below:
    exec lazarus.PopulateGridPositions;
    and gives the error.....
    BEGIN lazarus.PopulateGridPositions; END;
    ERROR at line 1:
    ORA-04063: package body "LAZARUS.LAZARUS" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "LAZARUS.LAZARUS"
    ORA-06512: at line 1
    The procedure and package have both compiled without errors and the statement on its own works fine in SQL*Plus.
    I've obviously missed some fundamental concept with scripts and SQL. Please can anybody help me?

    Histon FTM wrote:
    ORA-04063: package body "LAZARUS.LAZARUS" has errors Above, obviously conflicts with the statement that follows:
    >
    The procedure and package have both compiled without errors and the statement on its own works fine in SQL*Plus.I suggest you take a look in the USER_ERRORS view to see, what the errors are.
    And just checking:
    You have schema called LAZARUS, which holds a package named LAZARUS, which holds a procedure called POPULATEGRIDPOSITIONS?
    Edited by: Toon Koppelaars on Oct 1, 2009 5:55 PM

  • Calling sql script in plsql procedure

    Hello,
    I have a sql script named mytest.sql and i want to execute this from a stored procedure.
    following is the contents of this script
    spool d:\mytestsql.txt
    select * from tab;
    spool off
    Actually i want my sql script to run daily to export some tables data.
    I can execute this script from a sql prompt but i want to run it from enterprise manager.
    I am using oracle 10gR2 on windows2000 system.
    Any idea about scheduling the sql script to run automatically??
    How to execute this sql script from a plsql procedure??
    Thanks

    Hi all,
    Thanks for all the replies. I have found the solution with external procedures.
    Following is the complete step by step guide.
    1. Create the OSCommand Java Class using the following statement:
    connect as any user:
    create or replace and compile java source named oscommand as
    import java.io.*;
    public class OSCommand{
    public static String Run(String Command){
    try{
    Runtime.getRuntime().exec(Command);
    return("0");
    catch (Exception e){
    System.out.println("Error running command: " + Command +
    "\n" + e.getMessage());
    return(e.getMessage());
    2. Create the following Wrapper Function using the following statement:
    CREATE or REPLACE FUNCTION OSCommand_Run(Command IN STRING)
    RETURN VARCHAR2 IS
    LANGUAGE JAVA
    NAME 'OSCommand.Run(java.lang.String) return int';
    3. connect as sys
    Execute dbms_java.grant_permission( 'FKHALID','SYS:java.io.FilePermission', '<<ALL FILES>>','execute');
    execute dbms_java.grant_permission( 'FKHALID','SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '*' );
    execute dbms_java.grant_permission( 'FKHALID','SYS:java.lang.RuntimePermission', 'readFileDescriptor', '*' );
    commit;
    note: here fkhalid is the oracle user.
    connect as fkhalid user:
    Declare
    expdp_cmd Varchar2(2000);
    Begin
    expdp_cmd := OSCommand_Run('cmd /c sqlplus fkhalid@mtcedwt/pwd @d:\ORA_DUMPS\mydbexp.sql');
    DBMS_OUTPUT.Put_Line(expdp_cmd);
    End;
    In Unix
    Set Serverout On
    Declare
    x Varchar2(2000);
    Begin
    x := OSCommand_Run('/home/test/myoscommand.sh')
    DBMS_OUTPUT.Put_Line(x);
    End;
    I will check the dbms_scheduler also and will let you know the results.
    Thanks

  • Set maximum server memory by using sql scripts

    Dear all
    How to set maximum server memory by using sql scripts in sql server 2014? Thx a lot
    Best regards,
    Wallace

    You can use
    sys.Sp_Configure to set max server memory
    Here are some recommendation for Max Server memory based on RAM size
    GB
    MB
    Recommended Setting
    Command
    16
    16384
    14745
    EXEC sys.sp_configure 'max server memory (MB)', '14745'; RECONFIGURE;
    32
    32768
    29491
    EXEC sys.sp_configure 'max server memory (MB)', '29491'; RECONFIGURE;
    64
    65536
    58982
    EXEC sys.sp_configure 'max server memory (MB)', '58982'; RECONFIGURE;
    128
    131072
    117964
    EXEC sys.sp_configure 'max server memory (MB)', '117964'; RECONFIGURE;
    256
    262144
    235929
    EXEC sys.sp_configure 'max server memory (MB)', '235929'; RECONFIGURE;
    512
    524288
    471859
    EXEC sys.sp_configure 'max server memory (MB)', '471859'; RECONFIGURE;
    1024
    1048576
    943718
    EXEC sys.sp_configure 'max server memory (MB)', '943718'; RECONFIGURE;
    2048
    2097152
    1887436
    EXEC sys.sp_configure 'max server memory (MB)', '1887436'; RECONFIGURE;
    4096
    4194304
    3774873
    EXEC sys.sp_configure'max server memory (MB)', '3774873'; RECONFIGURE;
    Hope this will help
    Glad to help! Please remember to accept the answer if you found it helpful. It will be useful for future readers having same issue.

Maybe you are looking for

  • How do I get help with a malfunctioning Safari app on my iPad mini?

    I've been using the app successfully for quite some time. All of the sudden today, it started spontaneously closing. There is no warning or otherwise abnormal behavior. It simply shuts off. My device home screen appears, I re-open the app and it cont

  • HELP: Javascript dropdown menu

    Hi all, i am currently developing a website which is all ready to be uploaded but cant because of a javascript dropdown menu.. I have a flash slideshow in the center and on the rightside are 6 images (mainlinks) one below the other. Some of these mai

  • Preview will not 'flip horizontally'  a pdf

    Recently I just upgraded to 10.4.10 (from 10.3)...Using Preview to open a PDF, it will no longer flip (mirror) a pdf file vertical or horizontal. The option to do so shows in 'tools' but the text is grey like the command is not available. It will how

  • Data selection from graph

    Hello, I'm interested in graphing or charting binary data, and then selecting a subset of data within that graph to keep and analyze.  Essentially, I have very large data sets and it would be helpful to select out parts of that data to keep, and thro

  • Problems getting camera roll onto computer??

    If like me you had problems getting your camera roll onto your computer because it doesnt sync along with the photo library in itunes.I clicked computer on windows 7,then when you see your iphone you click on it then right click on it and you are giv