Login.sql

Here is my login.sql file for whenever I open up a SQL+ session:
SET TERMOUT OFF
COLUMN dbname NEW_VALUE prompt_dbname
SELECT LOWER(USER) || '@' || SUBSTR(gn.GLOBAL_NAME, 1, INSTR(gn.GLOBAL_NAME, '.') -1) AS dbname
  FROM GLOBAL_NAME gn;
SET SQLPROMPT "&&prompt_dbname> "
SET ARRAYSIZE 1 HEADING OFF UNDERLINE OFF
SELECT 'Logged in as user: ' || USER
  FROM dual;
SET TERMOUT ON TIME ON TIMING ON SERVEROUTPUT ON HEADING ON UNDERLINE ON ARRAYSIZE 15But when I login I doesn't execute the select statement
SELECT 'Logged in as user: ' || USER
  FROM dual;But if I type the "/" slash command and then enter I do get it to execute:
Here's the whole output
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Oct 6 12:22:25 2004
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production
12:22:26 dcp@DCPDEV> /
'LOGGEDINASUSER:'||USER
Logged in as user: DCP
Elapsed: 00:00:00.00
12:22:29 dcp@DCPDEV> How can I get it to execute the whole login.sql file?
Thanks,
Gio

But when I login I doesn't execute the select statementyes it does, but you do not see it, because you did set termout off

Similar Messages

  • Unable to Login SQL server management studio:sql server 2005

    Hello All,
    I am unbale to login SQL server management studio with below scanario:
    Server Type:Database Engine
    Server Name:XXX
    Authntication:Windows Auth
    After enter "Connect : button below eeror is displaying
    Error:"Canot connetc to XXX server
    Additional information:
    Attempted to read or write protected memory .This is an often an indication that the other memory is corrupt(System.Data)
    Note:Database is connecting R3trans return code 0000
    SAP is working fine
    Please provide suggestion and inpuits its very urgent
    Thanks
    Nekkalapu

    HI All,
    Issue resolved after rebooting the server.
    Thanks
    Nekkalapu

  • Cant run login.sql in 10.2.0.3

    using redhat linux. logging into sqlplus from the linux environment.
    my login.sql script does not run on login. when i try to execute it, nothing happens and i just get a new prompt. If I rename the file to login.old I can run it.
    I created a login.sql with just select 1 from dual; in it and it does not execute. if i rename the file to anything else it runs fine.
    I noticed that our prompts are now set up by sqlplus. I was wondering if they disabled writing your own login.sql ? However, the new setup does not run a define_editor=vi line which I need and tend to forget to run on my own.

    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch3.htm#sthref771
    sounds like -restrict 3.

  • Does SQL Developer has login.sql script where I can put all the env SQLs?

    Hello community,
    Please help me out with a simple question.
    Each time I start SQL Developer (3.1) and connect to a database I need to run:
    alter session set nls_date_format='YYYY.MM.DD HH24:MI:SS';
    to set data fields format to reflect hours, minutes and seconds.
    Can I automate it? I use login.sql in SQL Plus tro setup environment including data formant .
    How to do it in SQL Dev?
    Thank you in advance,
    Yury

    Hi Yury,
    You have a choice:
    1. Specify the login script via Tools|Preferences|Database|Filename for the connection startup script.
    2. Specify the value of nls_date_format directly via Tools|Preferences|NLS|Date Format (and perhaps additionally the Timestamp formats).
    Recall that not all SQL*Plus commands are supported by Worksheet, but alter session does in fact work just fine.
    Regards,
    Gary
    SQL Developer Team

  • Can't login SQL Server 2008 R2 Express management studio

    Hi i recently installed SQL Server 2008 R2 management studio. When I try to login i select 'Database engine' as the server type, I'm not sure what server name I'm
    supposed to be using but I tried .\SQLEXPRESS and authentication is 'SQL server Authentication'. But as for login and password I don't have one. During the installation I was not prompted to provide a login/password. As with the 2005 server installation I
    could by selecting 'mixed'. So how do i login for the first time on SQL server 2008 if i dont know/have my login/password?

    Hi,
    Try below links :
    http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
    http://stackoverflow.com/questions/360141/how-to-connect-to-local-instance-of-sql-server-2008-express
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e880c3be-a874-4979-8874-7044c087318d/sql-server-express-default-username-and-password
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • List of logins sql 2000 - 2008

    can anyone let me know which table in sql 2000, 2005 and 2008 lists all server level logins in a sql instance? Is it the same view/table per version (i.e. 2000--2008)?

    can anyone let me know which table in sql 2000, 2005 and 2008 lists all server level logins in a sql instance? Is it the same view/table per version (i.e. 2000--2008)?
    Hi,
    Syslogins conatain one row for each login account
    http://technet.microsoft.com/en-us/library/ms178593.aspx
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Login SQL per Connection

    I would like to have tha ability to configure a SQL-String or sqlscript like the Connection-Startup-Script but per Connectionconfiguration.
    I need this to set a Contextinformation on the Session.
    I didn't find such a ConfigurationOption until now.
    Developing a SQLDeveloper Extendion such as SchemaSelect (Welcome to Oracle SQL Developer Schema Selection extension) is an Option for me but I didnt get the right starting Point. Developing in Java but with eclipse and not JDeveloper and Link to Oracle SQLDeveloper SDK dident work.
    Thanks for any Help
    Martin Berner

    Barry
    If this is the default, then this must be new behaviour in 2766. I don't recall seeing this happen in the previous version and I wouldn't think it would be something that a lot of users would actually want to see happen by default. As I mentioned before, I personally find this feature to be an annoyance.
    If I may suggest: a better option would be to provide an option in Preferences to declare which startup script to run, if any.
    Regards,
    Jerry

  • Concurrent Logins SQL

    Is there anyway via SQL to get a count of how many users are currently logged into your EBS system? We need to do some checking for licensing purposes, so the plan was to run the same query once every 30 minutes for a week during peak working hours. We are operating R12 of EBS. I seem to remember a similar query doing the rounds on R11 but I cant find similar for R12.

    You can check below query as well which will provide more information on session details :
    SET show off
    SET VER OFF
    SET head on;
    SET timi on;
    UNDEFINE apps_user;
    ACCEPT apps_user char prompt 'Enter specific USERNAME  or else just ENTER  for all users ...: ';
    SET linesize 300;
    SET pagesize 200;
    COL sid_serial for a13;
    COL user_name for A10;
    COL module for a22;
    COL Responsibility for a29;
    COL function for a30;
    COL F_Type for a10;
    COL ap_pid for a6;
    COL db_pid for a6;
    BREAK on USER_NAME on db_pid on ap_pid on sid_serial
    SELECT   *
        FROM (SELECT usr.user_name user_name, v.spid db_pid, ses.process ap_pid,
                     ses.SID || ',' || ses.serial# sid_serial, ses.module,
                     rsp.responsibility_name responsibility,
                     fuc.function_name FUNCTION, i.function_type f_type,
                     TO_CHAR (i.last_connect, 'dd.mm hh24:mi') f_start
                FROM apps.icx_sessions i,
                     apps.fnd_logins l,
                     apps.fnd_appl_sessions a,
                     apps.fnd_user usr,
                     apps.fnd_responsibility_tl rsp,
                     apps.fnd_form_functions fuc,
                     gv$process v,
                     gv$session ses
               WHERE i.disabled_flag = 'N'
                 AND i.login_id = l.login_id
                 AND l.end_time IS NULL
                 AND i.user_id = usr.user_id
                 AND l.login_id = a.login_id
                 AND a.audsid = ses.audsid
                 AND l.pid = v.pid
                 AND l.serial# = v.serial#
                 AND i.responsibility_application_id = rsp.application_id(+)
                 AND i.responsibility_id = rsp.responsibility_id(+)
                 AND i.function_id = fuc.function_id(+)
                 AND i.responsibility_id NOT IN (
                                           SELECT t1.responsibility_id
                                             FROM apps.fnd_login_responsibilities t1
                                            WHERE t1.login_id = l.login_id)
                 AND usr.user_name LIKE '&apps_user%'
              UNION
              SELECT usr.user_name, v.spid, ses.process,
                     ses.SID || ',' || ses.serial# sid_serial, ses.module,
                     rsp.responsibility_name, NULL, NULL, NULL form_start_time
                FROM apps.fnd_logins l,
                     apps.fnd_login_responsibilities r,
                     apps.fnd_user usr,
                     apps.fnd_responsibility_tl rsp,
                     gv$process v,
                     gv$session ses
               WHERE l.end_time IS NULL
                 AND l.user_id = usr.user_id
                 AND l.pid = v.pid
                 AND l.serial# = v.serial#
                 AND v.addr = ses.paddr
                 AND l.login_id = r.login_id(+)
                 AND r.end_time IS NULL
                 AND r.responsibility_id = rsp.responsibility_id(+)
                 AND r.resp_appl_id = rsp.application_id(+)
                 AND r.audsid = ses.audsid
                 AND usr.user_name LIKE '&apps_user%'
              UNION
              SELECT usr.user_name, v.spid, ses.process,
                     ses.SID || ',' || ses.serial# sid_serial, ses.module, NULL,
                     frm.user_form_name, ff.TYPE,
                     TO_CHAR (f.start_time, 'dd.mm hh24:mi')
                FROM apps.fnd_logins l,
                     apps.fnd_login_resp_forms f,
                     apps.fnd_user usr,
                     apps.fnd_form_tl frm,
                     apps.fnd_form_functions ff,
                     gv$process v,
                     gv$session ses
               WHERE l.end_time IS NULL
                 AND l.user_id = usr.user_id
                 AND l.pid = v.pid
                 AND l.serial# = v.serial#
                 AND v.addr = ses.paddr
                 AND l.login_id = f.login_id(+)
                 AND f.end_time IS NULL
                 AND f.form_id = frm.form_id(+)
                 AND f.form_appl_id = frm.application_id(+)
                 AND f.audsid = ses.audsid
                 AND ff.form_id = frm.form_id
                 AND usr.user_name LIKE '&apps_user%'
              UNION
              SELECT fu.user_name, cr.oracle_process_id, cr.os_process_id,
                     vs.SID || ',' || vs.serial# sid_serial,
                     (SELECT cp.concurrent_program_name
                        FROM apps.fnd_concurrent_programs cp
                       WHERE cp.application_id = cr.program_application_id
                         AND cp.concurrent_program_id = cr.concurrent_program_id),
                     (SELECT responsibility_name
                        FROM apps.fnd_responsibility_vl
                       WHERE responsibility_id = cr.responsibility_id
                         AND application_id = cr.responsibility_application_id),
                     (SELECT execution_file_name
                        FROM apps.fnd_executables fe,
                             apps.fnd_concurrent_programs fcp
                       WHERE fcp.concurrent_program_id = cr.concurrent_program_id
                         AND fcp.application_id = cr.program_application_id
                         AND fe.executable_id = fcp.executable_id
                         AND fe.application_id = fcp.executable_application_id),
                     'REQUEST',
                     TO_CHAR (NVL (cr.actual_start_date, cr.requested_start_date),
                              'DD.MM HH24:MI'
                             ) start_time
                FROM apps.fnd_concurrent_requests cr,
                     v$process vp,
                     v$session vs,
                     apps.fnd_user fu
               WHERE cr.phase_code <> 'I'
                 AND (cr.phase_code < 'C' OR cr.phase_code > 'C')
    (cr.phase_code < 'I' OR cr.phase_code > 'I')
    AND (cr.phase_code < 'C' OR cr.phase_code > 'C')
                 AND cr.status_code NOT IN ('U', 'X', 'D', 'E', 'I', 'C')
                 AND cr.oracle_process_id = vp.spid(+)
                 AND cr.oracle_session_id = vs.audsid(+)
                 AND fu.user_id = cr.requested_by
                 AND vs.SID IS NOT NULL
                 AND fu.user_name LIKE '&apps_user%')
    ORDER BY user_name, db_pid, ap_pid, sid_serial;
    -Kj

  • SQL*Plus: Release 10.1.0.4.0 startup behaviour (glogin and login)

    Hi,
    I'm working in a unix environment where I have a lot of sql scripts to run using different DB users but only one OS user.
    I notice that in this version of SQL*Plus something was change regarding glogin and login scripts: they are executed also after a successful connect. There is no warning in the documentation to NOT use CONNECT in these scripts.
    What happens is recurrent execution of the same login script if there is a CONNECT command in it up to 20 time (the limit of recurrence in SQL*Plus). The only workaround I found is to put SET SQLPLUSCOMPATIBILITY to a prior version in the same login file before the CONNECT command.
    Has anyone a better idea ?
    Thank you.

    There is no warning in the documentation to NOT use CONNECT in these scripts.the change is documented
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12015.htm
    When you run a CONNECT command, the site profile, glogin.sql, and the user profile, login.sql, are executed.
    I understand your problem. The best would be to use a valid login and glogin script. I do not recommend big modification in glogin.
    Some tools, like OEMGC, particulary hates aggressive staff in glogin.sql, for example ALTER SESSION, etc...
    It is not recommended to do a "SET TERMOUT OFF" or a "WHENEVER SQLERROR CONTINUE" or any DML/DDL in your glogin, because it will irreversibily affect some scripts.
    The best I can rate you : remove your fancy staff from glogin.sql. If it is about the sql prompt, use 10g feature, like
    set SQLP _USER@""_CONNECT_IDENTIFIER>much better than selecting from global name!!!
    HTH
    Laurent

  • SQL Login

    Hi Guys,
    I'm learning SQL Server security, I have tried to create sql login and checked the local user and groups in the windows server and its not found there, Is SQL Server login a logical user within the SQL Server framework, will the sql logins be available outside
    of sql server ? for example: will it have a login access to the windows server ?  Will SQL Server create logins in the windows server ? I tried to login using the SQL Server login but its not working.
    With regards,
    Gopinath.
    With regards, Gopinath.

    no, sql logins do not exist outside of sql server. it is not like windows login. sql logins - strictly exist in sql server
    select * from master..syslogins
    --find your logins
    select * from master..syslogins
    --authentication mode on the server. restart requiured after the setting is changed
    SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly')
    WHEN 1 THEN 'Windows Authentication'
    WHEN 0 THEN 'Windows and SQL Server Authentication'
    END as [Authentication Mode]
    check this link  http://www.mssqltips.com/sqlservertip/2191/how-to-check-sql-server-authentication-mode-using-t-sql-and-ssms/
    make sure you  have mixed authentication enabled on the sql server. if enable it and restart the sql instance.
    if deployed on windows server 2008 and above, sql authentication is safe authentication as it can use kerberos.
    Hope it Helps!!

  • How to change Default editor in Linux for PL/SQL Programming

    Deare friends ,
    I am using oracle 8i (8.1.6) on RedHat Linux 7.2 , But i donot know how to change default editor for modify editor on sql prompt say ex:-
    In winodow
    SQL> ED
    it open nope pad to modify sql and pl/sql statement
    while in linux
    SLQ > ED
    it open one editor but it is not easy to work and i want to change that editor so could you tell me how to chane editor i want to use vi editor .
    if any boyd know reply me on :-
    [email protected]
    or on this forum
    Thanking you in advance
    Piyush Patel

    Either manually do a 'define editor=vi' when you log in through sql*plus, or put that in the glogin.sql in $ORACLEHOME/sqlplus/admin or put that in a login.sql in the directory you run sqlplus from.

  • All sql

    [./solutions/atonx.sql]
    REM
    REM script ATONX.SQL
    REM =====================================
    SET AUTOTRACE ON EXPLAIN
    [./solutions/saved_settings.sql]
    set appinfo OFF
    set appinfo "SQL*Plus"
    set arraysize 15
    set autocommit OFF
    set autoprint OFF
    set autorecovery OFF
    set autotrace OFF
    set blockterminator "."
    set cmdsep OFF
    set colsep " "
    set compatibility NATIVE
    set concat "."
    set copycommit 0
    set copytypecheck ON
    set define "&"
    set describe DEPTH 1 LINENUM OFF INDENT ON
    set echo OFF
    set editfile "afiedt.buf"
    set embedded OFF
    set escape OFF
    set feedback ON
    set flagger OFF
    set flush ON
    set heading ON
    set headsep "|"
    set linesize 80
    set logsource ""
    set long 80
    set longchunksize 80
    set markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PRE ON
    set newpage 1
    set null ""
    set numformat ""
    set numwidth 10
    set pagesize 14
    set pause OFF
    set recsep WRAP
    set recsepchar " "
    set serveroutput OFF
    set shiftinout invisible
    set showmode OFF
    set sqlblanklines OFF
    set sqlcase MIXED
    set sqlcontinue "> "
    set sqlnumber ON
    set sqlpluscompatibility 8.1.7
    set sqlprefix "#"
    set sqlprompt "SQL> "
    set sqlterminator ";"
    set suffix "sql"
    set tab ON
    set termout OFF
    set time OFF
    set timing OFF
    set trimout ON
    set trimspool OFF
    set underline "-"
    set verify ON
    set wrap ON
    [./solutions/sol_06_04d.sql]
    -- this script requires the sql id from the previous script to be substituted
    SELECT PLAN_TABLE_OUTPUT      
    FROM TABLE (DBMS_XPLAN.DISPLAY_AWR(' your sql id here'));
    [./solutions/rpsqlarea.sql]
    set feedback off
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('your sql_id here'));
    set feedback on
    [./solutions/sqlid2.sql]
    SELECT SQL_ID, SQL_TEXT FROM V$SQL
    WHERE SQL_TEXT LIKE '%REPORT%' ;
    [./solutions/schemastats.sql]
    SELECT last_analyzed analyzed, sample_size, monitoring,
    table_name
    FROM user_tables;
    [./solutions/allrows.sql]
    REM
    REM script ALLROWS.SQL
    REM =====================================
    alter session set optimizer_mode = all_rows
    [./solutions/aton.sql]
    REM
    REM script ATON.SQL
    REM =====================================
    SET AUTOTRACE ON
    [./solutions/li.sql]
    REM script LI.SQL (list indexes)
    REM wildcards in table_name allowed,
    REM and a '%' is appended by default
    REM ======================================
    set termout off
    store set sqlplus_settings replace
    save buffer.sql replace
    set verify off autotrace off
    set feedback off termout on
    break on table_name skip 1 on index_type
    col table_name format a25
    col index_name format a30
    col index_type format a20
    accept table_name -
    prompt 'List indexes on table : '
    SELECT ui.table_name
    , decode(ui.index_type
    ,'NORMAL', ui.uniqueness
    ,ui.index_type) AS index_type
    , ui.index_name
    FROM user_indexes ui
    WHERE ui.table_name LIKE upper('&table_name.%')
    ORDER BY ui.table_name
    , ui.uniqueness desc;
    get buffer.sql nolist
    @sqlplus_settings
    set termout on
    [./solutions/utlxplp.sql]
    Rem
    Rem $Header: utlxplp.sql 23-jan-2002.08:55:23 bdagevil Exp $
    Rem
    Rem utlxplp.sql
    Rem
    Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
    Rem
    Rem NAME
    Rem utlxplp.sql - UTiLity eXPLain Parallel plans
    Rem
    Rem DESCRIPTION
    Rem script utility to display the explain plan of the last explain plan
    Rem     command. Display also Parallel Query information if the plan happens to
    Rem run parallel
    Rem
    Rem NOTES
    Rem Assume that the table PLAN_TABLE has been created. The script
    Rem utlxplan.sql should be used to create that table
    Rem
    Rem With SQL*plus, it is recomended to set linesize and pagesize before
    Rem running this script. For example:
    Rem     set linesize 130
    Rem     set pagesize 0
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
    Rem bdagevil 04/05/01 - include CPU cost
    Rem bdagevil 02/27/01 - increase Name column
    Rem jihuang 06/14/00 - change order by to order siblings by.
    Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
    Rem bdagevil 01/05/00 - make deterministic with order-by
    Rem bdagevil 05/07/98 - Explain plan script for parallel plans
    Rem bdagevil 05/07/98 - Created
    Rem
    set markup html preformat on
    Rem
    Rem Use the display table function from the dbms_xplan package to display the last
    Rem explain plan. Use default mode which will display only relevant information
    Rem
    select * from table(dbms_xplan.display());
    [./solutions/cbinp.sql]
    REM Oracle10g SQL Tuning Workshop
    REM script CBI.SQL (create bitmap index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column: "
    set termout off
    store set saved_settings replace
    set heading off feedback off verify off
    set autotrace off termout on
    column dummy new_value index_name
    SELECT 'creating index'
    , SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
    TRANSLATE(REPLACE('&column_name', ' ', '')
    , 1, 25
    )||'_idx' dummy
    FROM dual;
    CREATE BITMAP INDEX &index_name ON &TABLE_NAME(&COLUMN_NAME)
    NOLOGGING COMPUTE STATISTICS
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/dump.sql]
    SElECT *
    FROM v$parameter
    WHERE name LIKE '%dump%';
    [./solutions/utlxplan.sql]
    rem
    rem $Header: utlxplan.sql 29-oct-2001.20:28:58 mzait Exp $ xplainpl.sql
    rem
    Rem Copyright (c) 1988, 2001, Oracle Corporation. All rights reserved.
    Rem NAME
    REM UTLXPLAN.SQL
    Rem FUNCTION
    Rem NOTES
    Rem MODIFIED
    Rem mzait 10/26/01 - add keys and filter predicates to the plan table
    Rem ddas 05/05/00 - increase length of options column
    Rem ddas 04/17/00 - add CPU, I/O cost, temp_space columns
    Rem mzait 02/19/98 - add distribution method column
    Rem ddas 05/17/96 - change search_columns to number
    Rem achaudhr 07/23/95 - PTI: Add columns partition_{start, stop, id}
    Rem glumpkin 08/25/94 - new optimizer fields
    Rem jcohen 11/05/93 - merge changes from branch 1.1.710.1 - 9/24
    Rem jcohen 09/24/93 - #163783 add optimizer column
    Rem glumpkin 10/25/92 - Renamed from XPLAINPL.SQL
    Rem jcohen 05/22/92 - #79645 - set node width to 128 (M_XDBI in gendef)
    Rem rlim 04/29/91 - change char to varchar2
    Rem Peeler 10/19/88 - Creation
    Rem
    Rem This is the format for the table that is used by the EXPLAIN PLAN
    Rem statement. The explain statement requires the presence of this
    Rem table in order to store the descriptions of the row sources.
    create table PLAN_TABLE (
         statement_id      varchar2(30),
         timestamp      date,
         remarks      varchar2(80),
         operation      varchar2(30),
         options      varchar2(255),
         object_node      varchar2(128),
         object_owner      varchar2(30),
         object_name      varchar2(30),
         object_instance numeric,
         object_type varchar2(30),
         optimizer varchar2(255),
         search_columns number,
         id          numeric,
         parent_id     numeric,
         position     numeric,
         cost          numeric,
         cardinality     numeric,
         bytes          numeric,
         other_tag varchar2(255),
         partition_start varchar2(255),
    partition_stop varchar2(255),
    partition_id numeric,
         other          long,
         distribution varchar2(30),
         cpu_cost     numeric,
         io_cost          numeric,
         temp_space     numeric,
    access_predicates varchar2(4000),
    filter_predicates varchar2(4000));
    [./solutions/indstats.sql]
    accept table_name -
    prompt 'on which table : '
    SELECT index_name name, num_rows n_r,
    last_analyzed l_a, distinct_keys d_k,
    leaf_blocks l_b, avg_leaf_blocks_per_key a_l,join_index j_I
    FROM user_indexes
    WHERE table_name = upper('&table_name');
    undef table_name
    [./solutions/test.sql]
    declare
    x number;
    begin
    for i in 1..10000 loop
    select count(*) into x from customers;
    end loop;
    end;
    [./solutions/rp.sql]
    set feedback off
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    set feedback on
    [./solutions/sol_08_02b.sql]
    ALTER SESSION SET SQL_TRACE = TRUE;
    [./solutions/trace.sql]
    ALTER SESSION SET SQL_TRACE = TRUE;
    [./solutions/doit.sql]
    DROP INDEX SALES_CH_BIX;
    DROP INDEX SALES_CUST_BIX;
    DROP INDEX SALES_PROD_BIX;
    [./solutions/ci.sql]
    REM SQL Tuning Workshop
    REM script CI.SQL (create index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column(s): "
    set termout off
    store set saved_settings replace
    set heading off feedback off autotrace off
    set verify off termout on
    column dummy new_value index_name
    SELECT 'creating index'
    , SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
    TRANSLATE(REPLACE('&column_name', ' ', '')
    , 1, 25
    )||'_idx' dummy
    FROM dual;
    CREATE INDEX &index_name
    ON &table_name(&column_name)
    NOLOGGING COMPUTE STATISTICS;
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/sol_06_04c.sql]
    exec dbms_workload_repository.create_snapshot('ALL');
    [./solutions/sol_06_04a.sql]
    column sql_text format a25
    SELECT SQL_ID, SQL_TEXT FROM V$SQL
    WHERE SQL_TEXT LIKE '%REPORT%' ;
    [./solutions/login.sql]
    REM ======================================
    REM COL[UMN] commands
    REM ======================================
    col dummy new_value index_name
    col name format a32
    col segment_name format a20
    col table_name format a20
    col column_name format a20
    col index_name format a30
    col index_type format a10
    col constraint_name format a20
    col num_distinct format 999999
    col update_comment format a20 word
    -- for the SHOW SGA/PARAMETER commands:
    col name_col_plus_show_sga format a24
    col name_col_plus_show_param format a40 -
    heading name
    col value_col_plus_show_param format a35 -
    heading value
    -- for the AUTOTRACE setting:
    col id_plus_exp format 90 head i
    col parent_id_plus_exp format 90 head p
    col plan_plus_exp format a80
    col other_plus_exp format a44
    col other_tag_plus_exp format a29
    col object_node_plus_exp format a8
    REM ======================================
    REM SET commands
    REM ======================================
    set describe depth 2
    set echo off
    set editfile D:\Tmp\buffer.sql
    set feedback 40
    set linesize 120
    set long 999
    set numwidth 8
    set pagesize 36
    set pause "[Enter]..." pause off
    set tab off
    set trimout on
    set trimspool on
    set verify off
    set wrap on
    REM ======================================
    REM DEFINE commands
    REM ======================================
    def 1=employees
    def table_name=employees
    def column_name=first_name
    def buckets=1
    def sc=';'
    REM ======================================
    REM miscellaneous
    REM ======================================
    [./solutions/sqlid.sql]
    SELECT SQL_ID, SQL_TEXT FROM V$SQL
    WHERE SQL_TEXT LIKE '%/* my%' ;
    [./solutions/hist1.sql]
    SELECT * FROM products WHERE prod_status LIKE 'available, on stock'
    [./solutions/sol_08_02.sql]
    ALTER SESSION SET TRACEFILE_IDENTIFIER = 'User12';
    [./solutions/utlxrw.sql]
    Rem
    Rem $Header: utlxrw.sql 29-apr-2005.08:22:09 mthiyaga Exp $
    Rem
    Rem utlxrw.sql
    Rem
    Rem Copyright (c) 2000, 2005, Oracle. All rights reserved.
    Rem
    Rem NAME
    Rem utlxrw.sql - Create the output table for EXPLAIN_REWRITE
    Rem
    Rem DESCRIPTION
    Rem Outputs of the EXPLAIN_REWRITE goes into the table created
    Rem by utlxrw.sql (called REWRITE_TABLE). So utlxrw must be
    Rem     invoked before any EXPLAIN_REWRITE tests.
    Rem
    Rem NOTES
    Rem If user specifies a different name in EXPLAIN_REWRITE, then
    Rem it should have been already created before calling EXPLAIN_REWRITE.
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem mthiyaga 04/29/05 - Remove unncessary comment
    Rem mthiyaga 06/08/04 - Add rewritten_txt field
    Rem mthiyaga 10/10/02 - Add extra columns
    Rem mthiyaga 09/27/00 - Create EXPLAIN_REWRITE output table
    Rem mthiyaga 09/27/00 - Created
    Rem
    Rem
    CREATE TABLE REWRITE_TABLE(
    statement_id VARCHAR2(30), -- id for the query
    mv_owner VARCHAR2(30), -- owner of the MV
    mv_name VARCHAR2(30), -- name of the MV
    sequence INTEGER, -- sequence no of the error msg
    query VARCHAR2(2000),-- user query
    query_block_no INTEGER, -- block no of the current subquery
    rewritten_txt VARCHAR2(2000),-- rewritten query
    message VARCHAR2(512), -- EXPLAIN_REWRITE error msg
    pass VARCHAR2(3), -- rewrite pass no
    mv_in_msg VARCHAR2(30), -- MV in current message
    measure_in_msg VARCHAR2(30), -- Measure in current message
    join_back_tbl VARCHAR2(30), -- Join back table in current msg
    join_back_col VARCHAR2(30), -- Join back column in current msg
    original_cost INTEGER, -- Cost of original query
    rewritten_cost INTEGER, -- Cost of rewritten query
    flags INTEGER, -- associated flags
    reserved1 INTEGER, -- currently not used
    reserved2 VARCHAR2(10)) -- currently not used
    [./solutions/nm.sql]
    ALTER INDEX &indexname NOMONITORING USAGE;
    [./solutions/attox.sql]
    REM
    REM script ATTOX.SQL
    REM =====================================
    set autotrace traceonly explain
    [./solutions/create_tab.sql]
    DROP TABLE test_sales;
    DROP TABLE test_promotions;
    DROP TABLE test_customers;
    DROP TABLE test_countries;
    CREATE table test_sales as select * from sales;
    CREATE TABLE test_promotions AS SELECT * FROM promotions;
    CREATE INDEX t_promo_id_idx ON TEST_PROMOTIONS(promo_id);
    ALTER TABLE test_promotions MODIFY promo_id PRIMARY KEY USING INDEX t_promo_id_idx;
    CREATE TABLE test_customers AS SELECT * FROM customers;
    CREATE INDEX t_cust_id_idx ON TEST_CUSTOMERS(cust_id);
    ALTER TABLE test_customers MODIFY cust_id PRIMARY KEY USING INDEX t_cust_id_idx;
    CREATE TABLE test_countries AS SELECT * FROM countries;
    CREATE INDEX t_country_id_idx ON TEST_COUNTRIES(country_id);
    ALTER TABLE test_countries MODIFY country_id PRIMARY KEY USING INDEX t_country_id_idx;
    UPDATE test_customers SET cust_credit_limit = 1000 WHERE ROWNUM <= 15000;
    [./solutions/cui.sql]
    REM SQL Tuning Workshop
    REM script CUI.SQL (create unique index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column(s): "\
    set termout off
    store set saved_settings replace
    set heading off feedback off verify off
    set autotrace off termout on
    SELECT 'creating unique index'
    , SUBSTR('ui_&TABLE_NAME._' ||
    TRANSLATE(REPLACE('&COLUMN_NAME', ' ', '')
    , 1, 30) dummy
    from dual
    CREATE UNIQUE INDEX &INDEX_NAME ON &TABLE_NAME(&COLUMN_NAME)
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/advisor_cache_setup.sql]
    set echo on
    alter system flush shared_pool;
    grant advisor to sh;
    connect sh/sh;
    SELECT c.cust_last_name, sum(s.amount_sold) AS dollars,
    sum(s.quantity_sold) as quantity
    FROM sales s , customers c, products p
    WHERE c.cust_id = s.cust_id
    AND s.prod_id = p.prod_id
    AND c.cust_state_province IN ('Dublin','Galway')
    GROUP BY c.cust_last_name;
    SELECT c.cust_id, SUM(amount_sold) AS dollar_sales
    FROM sales s, customers c WHERE s.cust_id= c.cust_id GROUP BY c.cust_id;
    select sum(unit_cost) from costs group by prod_id;
    [./solutions/utlxmv.sql]
    Rem
    Rem $Header: utlxmv.sql 16-feb-2001.13:03:32 nshodhan Exp $
    Rem
    Rem utlxmv.sql
    Rem
    Rem Copyright (c) Oracle Corporation 2000. All Rights Reserved.
    Rem
    Rem NAME
    Rem utlxmv.sql - UTiLity for eXplain MV
    Rem
    Rem DESCRIPTION
    Rem The utility script creates the MV_CAPABILITIES_TABLE that is
    Rem used by the DBMS_MVIEW.EXPLAIN_MVIEW() API.
    Rem
    Rem NOTES
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem nshodhan 02/16/01 - Bug#1647071: replace mv with mview
    Rem raavudai 11/28/00 - Fix comment.
    Rem twtong 12/01/00 - fix for sql*plus
    Rem twtong 09/13/00 - modify mv_capabilities_tabe
    Rem twtong 08/18/00 - change create table to upper case
    Rem jraitto 06/12/00 - add RELATED_NUM and MSGNO columns
    Rem jraitto 05/09/00 - Explain_MV table
    Rem jraitto 05/09/00 - Created
    Rem
    CREATE TABLE MV_CAPABILITIES_TABLE
    (STATEMENT_ID VARCHAR(30), -- Client-supplied unique statement identifier
    MVOWNER VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW
    MVNAME VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW
    CAPABILITY_NAME VARCHAR(30), -- A descriptive name of the particular
    -- capability:
    -- REWRITE
    -- Can do at least full text match
    -- rewrite
    -- REWRITE_PARTIAL_TEXT_MATCH
    -- Can do at leat full and partial
    -- text match rewrite
    -- REWRITE_GENERAL
    -- Can do all forms of rewrite
    -- REFRESH
    -- Can do at least complete refresh
    -- REFRESH_FROM_LOG_AFTER_INSERT
    -- Can do fast refresh from an mv log
    -- or change capture table at least
    -- when update operations are
    -- restricted to INSERT
    -- REFRESH_FROM_LOG_AFTER_ANY
    -- can do fast refresh from an mv log
    -- or change capture table after any
    -- combination of updates
    -- PCT
    -- Can do Enhanced Update Tracking on
    -- the table named in the RELATED_NAME
    -- column. EUT is needed for fast
    -- refresh after partitioned
    -- maintenance operations on the table
    -- named in the RELATED_NAME column
    -- and to do non-stale tolerated
    -- rewrite when the mv is partially
    -- stale with respect to the table
    -- named in the RELATED_NAME column.
    -- EUT can also sometimes enable fast
    -- refresh of updates to the table
    -- named in the RELATED_NAME column
    -- when fast refresh from an mv log
    -- or change capture table is not
    -- possilbe.
    POSSIBLE CHARACTER(1), -- T = capability is possible
    -- F = capability is not possible
    RELATED_TEXT VARCHAR(2000),-- Owner.table.column, alias name, etc.
    -- related to this message. The
    -- specific meaning of this column
    -- depends on the MSGNO column. See
    -- the documentation for
    -- DBMS_MVIEW.EXPLAIN_MVIEW() for details
    RELATED_NUM NUMBER, -- When there is a numeric value
    -- associated with a row, it goes here.
    -- The specific meaning of this column
    -- depends on the MSGNO column. See
    -- the documentation for
    -- DBMS_MVIEW.EXPLAIN_MVIEW() for details
    MSGNO INTEGER, -- When available, QSM message #
    -- explaining why not possible or more
    -- details when enabled.
    MSGTXT VARCHAR(2000),-- Text associated with MSGNO.
    SEQ NUMBER);
                        -- Useful in ORDER BY clause when
    -- selecting from this table.
    [./solutions/di.sql]
    DROP INDEX &index_name;
    [./solutions/hist2.sql]
    SELECT * FROM products WHERE prod_status = 'obsolete'
    [./solutions/sol_06_04b.sql]
    -- this script requires the sql_id that you got from the previous step
    SELECT SQL_ID, SQL_TEXT FROM dba_hist_sqltext where sql_id ='yourr sql id here';
    [./solutions/tabstats.sql]
    accept table_name -
    prompt 'on which table : '
    SELECT last_analyzed analyzed, sample_size, monitoring,
    table_name
    FROM user_tables
    WHERE table_name = upper('&table_name');
    undef TABLE_NAME
    [./solutions/rewrite.sql]
    ALTER SESSION SET QUERY_REWRITE_ENABLED = true
    [./solutions/atto.sql]
    REM
    REM script ATTO.SQL
    REM =====================================
    set autotrace traceonly
    [./solutions/flush.sql]
    --this script flushes the shared pool
    alter system flush shared_pool
    [./solutions/atoff.sql]
    REM
    REM script ATOFF.SQLREM =====================================
    SET AUTOTRACE OFF
    [./solutions/cbi.sql]
    REM Oracle10g SQL Tuning Workshop
    REM script CBI.SQL (create bitmap index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column: "
    set termout off
    store set saved_settings replace
    set heading off feedback off verify off
    set autotrace off termout on
    column dummy new_value index_name
    SELECT 'creating index'
    , SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
    TRANSLATE(REPLACE('&column_name', ' ', '')
    , 1, 25
    )||'_idx' dummy
    FROM dual;
    CREATE bitmap index &INDEX_NAME on &TABLE_NAME(&COLUMN_NAME)
    LOCAL NOLOGGING COMPUTE STATISTICS
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/buffer.sql]
    SELECT c.cust_last_name, c.cust_year_of_birth
    , co.country_name
    FROM customers c
    JOIN countries co
    USING (country_id)
    [./solutions/sol_08_04.sql]
    ALTER SESSION SET SQL_TRACE = false;
    [./solutions/sqlplus_settings.sql]
    set appinfo OFF
    set appinfo "SQL*Plus"
    set arraysize 15
    set autocommit OFF
    set autoprint OFF
    set autorecovery OFF
    set autotrace TRACEONLY EXPLAIN STATISTICS
    set blockterminator "."
    set cmdsep OFF
    set colsep " "
    set compatibility NATIVE
    set concat "."
    set copycommit 0
    set copytypecheck ON
    set define "&"
    set describe DEPTH 1 LINENUM OFF INDENT ON
    set echo OFF
    set editfile "afiedt.buf"
    set embedded OFF
    set escape OFF
    set feedback 6
    set flagger OFF
    set flush ON
    set heading ON
    set headsep "|"
    set linesize 80
    set logsource ""
    set long 80
    set longchunksize 80
    set markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PRE OFF
    set newpage 1
    set null ""
    set numformat ""
    set numwidth 10
    set pagesize 14
    set pause OFF
    set recsep WRAP
    set recsepchar " "
    set serveroutput OFF
    set shiftinout invisible
    set showmode OFF
    set sqlblanklines OFF
    set sqlcase MIXED
    set sqlcontinue "> "
    set sqlnumber ON
    set sqlpluscompatibility 8.1.7
    set sqlprefix "#"
    set sqlprompt "SQL> "
    set sqlterminator ";"
    set suffix "sql"
    set tab ON
    set termout OFF
    set time OFF
    set timing OFF
    set trimout ON
    set trimspool OFF
    set underline "-"
    set verify ON
    set wrap ON
    [./solutions/sol_07_01.sql]
    SELECT owner, job_name,enabled
    FROM DBA_SCHEDULER_JOBS
    WHERE JOB_NAME = 'GATHER_STATS_JOB';
    [./solutions/colhist.sql]
    SELECT column_name, num_distinct, num_buckets, histogram
    FROM USER_TAB_COL_STATISTICS
    WHERE histogram <> 'NONE';
    [./solutions/rpawr.sql]
    set feedback off
    SELECT PLAN_TABLE_OUTPUT      
    FROM TABLE (DBMS_XPLAN.DISPLAY_AWR('&sqlid'));
    set feedback on
    [./solutions/im.sql]
    ALTER INDEX &indexname MONITORING USAGE;
    [./solutions/utlxpls.sql]
    Rem
    Rem $Header: utlxpls.sql 26-feb-2002.19:49:37 bdagevil Exp $
    Rem
    Rem utlxpls.sql
    Rem
    Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
    Rem
    Rem NAME
    Rem utlxpls.sql - UTiLity eXPLain Serial plans
    Rem
    Rem DESCRIPTION
    Rem script utility to display the explain plan of the last explain plan
    Rem     command. Do not display information related to Parallel Query
    Rem
    Rem NOTES
    Rem Assume that the PLAN_TABLE table has been created. The script
    Rem     utlxplan.sql should be used to create that table
    Rem
    Rem With SQL*plus, it is recomended to set linesize and pagesize before
    Rem running this script. For example:
    Rem     set linesize 100
    Rem     set pagesize 0
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem bdagevil 02/26/02 - cast arguments
    Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
    Rem bdagevil 04/05/01 - include CPU cost
    Rem bdagevil 02/27/01 - increase Name column
    Rem jihuang 06/14/00 - change order by to order siblings by.
    Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
    Rem bdagevil 01/05/00 - add order-by to make it deterministic
    Rem kquinn 06/28/99 - 901272: Add missing semicolon
    Rem bdagevil 05/07/98 - Explain plan script for serial plans
    Rem bdagevil 05/07/98 - Created
    Rem
    set markup html preformat on
    Rem
    Rem Use the display table function from the dbms_xplan package to display the last
    Rem explain plan. Force serial option for backward compatibility
    Rem
    select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
    [./solutions/dai.sql]
    REM script DAI.SQL (drop all indexes)
    REM prompts for a table name; % is appended
    REM does not touch indexes associated with constraints
    REM ==================================================
    accept table_name -
    prompt 'on which table : '
    set termout off
    store set sqlplus_settings replace
    save buffer.sql replace
    set heading off verify off autotrace off feedback off
    spool doit.sql
    SELECT 'drop index '||i.index_name||';'
    FROM user_indexes i
    WHERE i.table_name LIKE UPPER('&table_name.%')
    AND NOT EXISTS
    (SELECT 'x'
    FROM user_constraints c
    WHERE c.index_name = i.index_name
    AND c.table_name = i.table_name
    AND c.status = 'ENABLED');
    spool off
    @doit
    get buffer.sql nolist
    @sqlplus_settings
    set termout on
    [./solutions/setupenv.sql]
    connect system/oracle
    GRANT DBA TO sh;
    GRANT CREATE ANY OUTLINE TO sh;
    GRANT ADVISOR TO sh;
    GRANT CREATE ANY VIEW TO sh;
    EXECUTE DBMS_

    What an insane topic. Where's your question?
    I recommend you to start over with a smart question and only the relevant code lines.
    Check this link: [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html].

  • Connect RD Connection Broker to SQL

    Hello I'm not being able to install RD Connection Broker with High Availability.
    The RDS deployment consists on two servers running win2012
    server1 - RDWA and RDG
    server2 - RDSH and RDCB
    The SQL server 2012 that I'm using is installed on server2 itself and had to be installed after the RDS otherwise the SQL installation failed and had to be done using the RD-install. It's working fine , I've applications that run on it.
    As when configuring RDCB HA "both" RDCB hosts access directly to the SQL DB to create a new database, their accounts need to be authenticated as a SQL login with dbcreator role.
    1 step: I checked a straight forward installation_
    Installing and Configuring RD Connection Broker High Availability in Windows Server 2012
    Failed
    2 step: I checked an installation where my problem happened.
    I checked RD Connection Broker HA – SQL Permissions
    Added the host to a domain group and added the group as an SQL login, SQL authentication failed.
    4 step: Google for how to create SQL login for a computer account and  I added it by executing:
    “CREATE LOGIN [MyDomain\MyComputer$]
    FROM WINDOWS”
    Also tried to use Add-ADcomputerServiceAccount without success.
    3 step: I ended here
    Taking a closer look at RD Connection Broker High Availability in Windows
    Server 2012
    Where I verified that none of the following explanations were correct:
    The SQL Server Native client is not installed
    A firewall is blocking SQL Access from the RD Connection Broker (port 1433)
    The incorrect SQL Server Native Client version is specified
    An incorrect SQL Server name is specified
    I tried several variations of the string to use but this is the one I think it's correct:
    DRIVER=SQL Server Native Client 11.0;SERVER=WIN2012-1;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;Database=RDCB
    The error registered on SQL is:
    "Message
    Login failed for user 'RDS\WIN2012-1$'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]"
    I tried to connect via ODBC with an existing username an it succeeded.
    The problem seems to be with the computer account not existing as an SQL login...the thing is that it exists.
    I need to set this up in order to be able to change the RDCB FQDN to a public FQDN.
    How were you guys able to overcome this? Did you faced this at all?
    Thanks,
    David

    Guys,
    I suffered with a very similar problem when setting up an RDS 2012 environment using SQL Server 2014 sitting on a server core VM, and two connection brokers sitting on server core OS as well. 
    My SQL logs were filling with with login failed for the connection brokers computer account even though I had configured the SQL permissions correctly. 
    In the end it was Arjan's post above that got me fixed, rebooting the connection broker VMs. Really annoying, as I let AD propagate over night, just in case that was the issue. After simply rebooting the connection brokers, this worked. For anyone who needs
    it, my SQL databases are stored on a separate D: drive and I used the string below:
    DRIVER=SQL Server Native Client 11.0;SERVER=<SQL Server Name>;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;DATABASE=<DB Name>.
    Hope this helps someone else.

  • Pl/sql using DECODE

    Hello,
    i have question regarding PL/SQL using DECODE when i use following qurey in SQL plus it is working fine but when i try to run in tode it only display value of g.
    everything else is blank........
    so can u plz assist me on that .....
    thanks in advance!!!!!!!!!!
    SELECT
    b.g,b.s,
    COUNT(DECODE(a.u,'R',a.rep)) AS R,
    COUNT(DECODE(a.u,'u',a.rep)) AS U,
    COUNT(DECODE(a.u,'C',a.rep))AS C,
    COUNT(DECODE(a.u,'I',a.rep)) AS I,
    COUNT(DECODE(a.u,NULL,a.rep)) AS B
    FROM AREA a, data b
    WHERE a.rep = '454637'
    AND a.rep = b.emp
    GROUP BY b.g,b.s

    Very strange.
    Find out if there are alterations to your SQL*PLUS envirionment. Warren mentioned user/database wierdness; the ALTER SCHEMA and other commands can affect privilges and what objects you can see. Sometimes these commands are buried in LOGIN.SQL and GLOGIN.SQL files (for SQL*PLUS), and more hard to find they can call files buried on a network somewhere.
    Try the query without the DECODE() and see what's in the table without trying to modify the values in both envirionments.

  • Seek help to format spool file from SQL*PLUS

    I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
    DUMMY
    DB_NAME
    I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
    Conn system/password@Oracle_SID
    How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!

    Hi,
    It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
    You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
    What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script.

Maybe you are looking for