SQL Server error during create database through jdbc

Hi ,
Can anybody figure why I get the following exception
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near '9876'.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
I am trying to create a new database through jdbc, I use only numeric characters in the database name.
I can create the same database through SQL Enterprise Manager.
-vikram

The name of the database is 9876?
Plan A: save yourself trouble and start database/table/column names with a letter.
Plan B: if you really must, try quoting the database name: create database "9867".

Similar Messages

  • Error during create database connection (JDeveloper)

    Hello!
    Have you any suggestions of this: When I try to create new database connection to 9i DBMS, I've got errors:
    ORA-00604: error with recursive SQL
    ORA-12705: Invalid or unknown NLS parameter value specified.
    At the same time I try to do the same with another one DBMS,
    10g, and everything is Ok.
    Thanks.
    Andrew.

    Stephen, sure, I did all actions you described, during "Create new Database Connection":
    (filling in driver (thin), host name (i.e. localhost), jdbc port (i.e. 1521), and sid (i.e. orcl) )
    Th result I think should be looks like
    jdbc:oracle:thin:@wizard.shots.ru:1522:VIVD
    (tns for that DBMS is
    VIVD.WORLD =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = wizard.shots.ru)(PORT = 1522))
    (CONNECT_DATA = (SID = VIVD))
    As I wrote, the same actions give OK result, if dbms = 10g.
    But, I want to test OEBS adapter, and OEBS stands on 9i DBMS only,
    so I need to work with 9i
    Thanks.
    Andrew.

  • How to determine different errors during update database with JDBC 2.0

    During updating my database (MS Access 2000) using JDBC 2.0, I entered a value for the primary key field which has existed
    in the database. However, when executing the method "udpateRow()" it gives me an error message "Error in row" and the
    database was not updated.
    When I update an Integer field with a non-integer value (e.g: Characters ), it also gives me the same error message. When I
    update a Date field with a non-date value, it still displays the same error message.
    How can I determine for each of the cases from the SQLException thrown that the actual error has occurred since I want to
    display a different customized message indicating the different errors that occurred during updating??
    Currently, part of my code is as follows:
              int currentRow = rs.getRow();
              String values[] = new String[ rsmd.getColumnCount() ];
              // Initialize values[] begins here:
              for( int count = 1; count <= rsmd.getColumnCount(); count++ ) {
                   rs.updateObject( count, values[ count - 1 ] );
              try{
                   rs.updateRow();
              catch( SQLException e ) {
                   System.out.println( e.getMessage() );
                   rs.cancelRowUpdates();
                   rs.absolute( currentRow );
    Can someone please help me solve this problem?? THANKS.. :)

    Rather than attempting to figure out which column value causes the update to fail, I would try validating the input data before you attempt to use it in a SQL update. Of course, this would only be useful if you know what data types the inputs are supposed to be in advance of running the update.
    William

  • Wait on the Database Engine recovery handle failed. Check the SQL server error log for potential causes in SQL Server 2012 Developer Edition

    I m using SQL Server 2012 Developer Edition. Even I tried 2012 express and enterprise edition but all
    gave same error. I browsed msdn blog. But nothing help me out.
    Below is the error log details--
    Overall summary:
      Final result:                  Failed: see details below
      Exit code (Decimal):           -2061893606
      Start time:                    2013-10-21 12:58:05
      End time:                      2013-10-21 13:52:30
      Requested action:              Install
    Setup completed with required actions for features.
    Troubleshooting information for those features:
      Next step for RS:              Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Next step for SQLEngine:       Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Next step for DQ:              Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Next step for FullText:        Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Next step for Replication:     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
    Machine Properties:
      Machine name:                  CROY-TOSH
      Machine processor count:       4
      OS version:                    Windows 7
      OS service pack:               Service Pack 1
      OS region:                     United States
      OS language:                   English (United States)
      OS architecture:               x64
      Process architecture:          64 Bit
      OS clustered:                  No
    Product features discovered:
      Product              Instance             Instance ID                    Feature                
                     Language             Edition              Version         Clustered 
    Package properties:
      Description:                   Microsoft SQL Server 2012 Service Pack 1
      ProductName:                   SQL Server 2012
      Type:                          RTM
      Version:                       11
      SPLevel:                       0
      Installation location:         C:\Users\CRoy\Downloads\SQL Server 2012 Developer Edition (x86 and x64) - DVD (English)\x64\setup\
      Installation edition:          Developer
    Product Update Status:
      None discovered.
    User Input Settings:
      ACTION:                        Install
      ADDCURRENTUSERASSQLADMIN:      false
      AGTSVCACCOUNT:                 NT Service\SQLSERVERAGENT
      AGTSVCPASSWORD:                *****
      AGTSVCSTARTUPTYPE:             Manual
      ASBACKUPDIR:                   C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Backup
      ASCOLLATION:                   Latin1_General_CI_AI
      ASCONFIGDIR:                   C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Config
      ASDATADIR:                     C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Data
      ASLOGDIR:                      C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Log
      ASPROVIDERMSOLAP:              1
      ASSERVERMODE:                  MULTIDIMENSIONAL
      ASSVCACCOUNT:                  NT Service\MSSQLServerOLAPService
      ASSVCPASSWORD:                 <empty>
      ASSVCSTARTUPTYPE:              Automatic
      ASSYSADMINACCOUNTS:            CRoy-TOSH\CRoy
      ASTEMPDIR:                     C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Temp
      BROWSERSVCSTARTUPTYPE:         Disabled
      CLTCTLRNAME:                   ROY
      CLTRESULTDIR:                  C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\ResultDir\
      CLTSTARTUPTYPE:                Manual
      CLTSVCACCOUNT:                 NT Service\SQL Server Distributed Replay Client
      CLTSVCPASSWORD:                <empty>
      CLTWORKINGDIR:                 C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\WorkingDir\
      COMMFABRICENCRYPTION:          0
      COMMFABRICNETWORKLEVEL:        0
      COMMFABRICPORT:                0
      CONFIGURATIONFILE:             C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20131021_125116\ConfigurationFile.ini
      CTLRSTARTUPTYPE:               Manual
      CTLRSVCACCOUNT:                NT Service\SQL Server Distributed Replay Controller
      CTLRSVCPASSWORD:               <empty>
      CTLRUSERS:                     CRoy-TOSH\CRoy
      ENABLERANU:                    false
      ENU:                           true
      ERRORREPORTING:                true
      FEATURES:                      SQLENGINE, REPLICATION, FULLTEXT, DQ, AS, RS, RS_SHP, RS_SHPWFE, DQC, BIDS, CONN, IS, BC, SDK, BOL, SSMS, ADV_SSMS, DREPLAY_CTLR, DREPLAY_CLT, SNAC_SDK, MDS
      FILESTREAMLEVEL:               2
      FILESTREAMSHARENAME:           MSSQLSERVER
      FTSVCACCOUNT:                  NT Service\MSSQLFDLauncher
      FTSVCPASSWORD:                 <empty>
      HELP:                          false
      IACCEPTSQLSERVERLICENSETERMS:  false
      INDICATEPROGRESS:              false
      INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
      INSTALLSHAREDWOWDIR:           C:\Program Files (x86)\Microsoft SQL Server\
      INSTALLSQLDATADIR:             <empty>
      INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
      INSTANCEID:                    MSSQLSERVER
      INSTANCENAME:                  MSSQLSERVER
      ISSVCACCOUNT:                  NT Service\MsDtsServer110
      ISSVCPASSWORD:                 <empty>
      ISSVCSTARTUPTYPE:              Automatic
      MATRIXCMBRICKCOMMPORT:         0
      MATRIXCMSERVERNAME:            <empty>
      MATRIXNAME:                    <empty>
      NPENABLED:                     0
      PID:                           *****
      QUIET:                         false
      QUIETSIMPLE:                   false
      ROLE:                          <empty>
      RSINSTALLMODE:                 DefaultNativeMode
      RSSHPINSTALLMODE:              SharePointFilesOnlyMode
      RSSVCACCOUNT:                  NT Service\ReportServer
      RSSVCPASSWORD:                 <empty>
      RSSVCSTARTUPTYPE:              Automatic
      SAPWD:                         *****
      SECURITYMODE:                  SQL
      SQLBACKUPDIR:                  <empty>
      SQLCOLLATION:                  Latin1_General_CI_AI
      SQLSVCACCOUNT:                 NT Service\MSSQLSERVER
      SQLSVCPASSWORD:                *****
      SQLSVCSTARTUPTYPE:             Automatic
      SQLSYSADMINACCOUNTS:           CRoy-TOSH\CRoy
      SQLTEMPDBDIR:                  <empty>
      SQLTEMPDBLOGDIR:               <empty>
      SQLUSERDBDIR:                  <empty>
      SQLUSERDBLOGDIR:               <empty>
      SQMREPORTING:                  false
      TCPENABLED:                    0
      UIMODE:                        Normal
      UpdateEnabled:                 true
      UpdateSource:                  MU
      X86:                           false
      Configuration file:            C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20131021_125116\ConfigurationFile.ini
    Detailed results:
      Feature:                       Management Tools - Complete
      Status:                        Passed
      Feature:                       Client Tools Connectivity
      Status:                        Passed
      Feature:                       Client Tools SDK
      Status:                        Passed
      Feature:                       Client Tools Backwards Compatibility
      Status:                        Passed
      Feature:                       Management Tools - Basic
      Status:                        Passed
      Feature:                       SQL Server Data Tools
      Status:                        Passed
      Feature:                       Reporting Services - Native
      Status:                        Failed: see logs for details
      Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
      Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A001A
      Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026
      Feature:                       Database Engine Services
      Status:                        Failed: see logs for details
      Reason for failure:            An error occurred during the setup process of the feature.
      Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A001A
      Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026
      Feature:                       Data Quality Services
      Status:                        Failed: see logs for details
      Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
      Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A001A
      Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026
      Feature:                       Full-Text and Semantic Extractions for Search
      Status:                        Failed: see logs for details
      Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
      Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A001A
      Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026
      Feature:                       SQL Server Replication
      Status:                        Failed: see logs for details
      Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
      Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A001A
      Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026
      Feature:                       Master Data Services
      Status:                        Passed
      Feature:                       Distributed Replay Client
      Status:                        Passed
      Feature:                       Distributed Replay Controller
      Status:                        Passed
      Feature:                       Integration Services
      Status:                        Passed
      Feature:                       Data Quality Client
      Status:                        Passed
      Feature:                       Analysis Services
      Status:                        Passed
      Feature:                       Reporting Services - SharePoint
      Status:                        Passed
      Feature:                       Reporting Services Add-in for SharePoint Products
      Status:                        Passed
      Feature:                       SQL Browser
      Status:                        Passed
      Feature:                       Documentation Components
      Status:                        Passed
      Feature:                       SQL Writer
      Status:                        Passed
      Feature:                       SQL Client Connectivity
      Status:                        Passed
      Feature:                       SQL Client Connectivity SDK
      Status:                        Passed
    Rules with failures:
    Global rules:
    Scenario specific rules:
    Rules report file:               C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20131021_125116\SystemConfigurationCheck_Report.htm

    Hi,
    This 3rd time I followed this link. But nothing new, same error.
    Can you please tell me how to do follow, I cannt do the 1st step, how to change the local system to windows level account, vice-versa. It is shown mine as
    Server Configuration Manager(Local) 
    From here I folllowed the steps ---[I cannt insert link/image :-(]
    SQL 2008/R2 setup fails with "Wait on the database engine recovery handle failed" 
    If I right clicked on SQL Server Service, there is no option to change the account. 
    Hello,
    Thanks for your patience,did you tried stesp mentioned in below article
    http://blogs.msdn.com/b/sqljourney/archive/2012/03/16/sql-2008-r2-setup-fails-with-quot-wait-on-the-database-engine-recovery-handle-failed-quot.aspx
    To resolve it, follow these steps:-
    When the installation throws this error, click on OK and allow it to proceed. It will fail for Database Engine, but the SQL Server service should have
    been created. Check the Services console.
    If the service is present, perform the following steps:-
    1. Go to SQL Server Configuration manager, right click on the SQL Server service, and change the service account (if it is local system, give
    it a windows level account, and vice-versa). It might throw a WMI error but you will see the account getting updated anyway. If not, then use the Services console. Change the account for SQL Agent as well.
    Use this link to change sql server service account
    http://technet.microsoft.com/en-us/library/ms345578.aspx
    2. Next, try to start the service. It should come online.
    3. However, you will not be able to log in to the SQL Server
    4. Now stop the service and start it from the command prompt using -m -c -T3608 parameters.
    5. Now try logging in to the server using admin connection from sqlcmd (sqlcmd admin:<server name>\<instance name> ...)
    6. Once logged in, use the sp_addsrvrolemember '<domain\username>','sysadmin'.
    Also add the builtin/administrators to the sysadmin role
    7. Now stop the service from the command prompt and start it from SQL Server configuration manager
    You should be able to log in to the server now.
    Hope this helps someone.
    Please revert if it helps or even if it does not
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • The SELECT permissions was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'.(Microsoft SQL Server, Error:229

    I have a SQL Server connected intro a Windows Server 2003 Domain Active Directory, the server holds a default instance with a single Database, the SQL Server is 2005 Std Edition, and is using mix mode Authentification, then I able to create SQL Native Users
    and Invoque Windows Domain Users also.
    The Goal of this project is remove the sysadmin Server role for all the Windows Domain Users, to give then a more granular secure model but at the moment is this only way to connect at the Data Base Server.
    I already create Native SQL Servers users without any problem!, they respect Securable Setting, Server Roles, User Mapping, everything...Just when I create a Login Profile form a Domain Users and apply the same setting, I get this error...
    The SELECT permissions was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'.(Microsoft SQL Server, Error:229)
    But if the user have sysadmin Server Rol he can sing over the server without any issue, I review the .sys view extended_properties and "Public" is the only Database Role placed.
    Any Idea if I need change any Setting in the Secure in SQL Master DataBase? or which is the issue witjh this matter?
    Thank in advance for your help!

    Since there are so many possibilities for what might be wrong.  Here's another possibility to look at.  I ran into something where I had set up my own roles on a database.  (For instance, "Administrator", "Manager", "DataEntry",
    "Customer", each with their own kinds of limitations)  The only ones who could use it were "Manager" role or above--because they were also set up as sysadmin because they were adding users to the database (and they were highly trusted). 
    Also, the users that were being added were Windows Domain users--using their domain credentials.  (Everyone with access to the database had to be on our domain, but not everyone on the domain had access to the database--and only a few of them had access
    to change it.)
    Anyway, this working system suddenly stopped working and I was getting error messages similar to the above.  What I ended up doing that solved it was to go through all the permissions for the "public" role in that database and add those permissions
    to all of the roles that I had created.  I know that everyone is supposed to be in the "public" role even though you can't add them (or rather, you can "add" them, but they won't "stay added").
    So, in "SQL Server Management Studio", I went into my application's database, in other words (my localized names are obscured within <> brackets): "<Computername> (SQL Server <version> - sa)"\Databases\<MyAppDB>\Security\Roles\Database
    Roles\public".  Right-click on "public" and select "Properties".  In the "Database Role Properties - public" dialog, select the "Securables" page.  Go through the list and for each element in the
    list, come up with an SQL "Grant" statement to grant exactly that permission to another role.  So, for instance, there is a scalar function "[dbo].[fn_diagramobjects]" on which the "public" role has "Execute" privilege. 
    So, I added the following line:   
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @RoleName + '];' )
    Once I had done this for all the elements in the "Securables" list, I wrapped that up in a while loop on a cursor selecting through all the roles in my roles table.  This explicitly granted all the permissions of the "public" role to
    my database roles.  At that point, all my users were working again (even after I removed their "sysadmin" access--done as a temporary measure while I figured out what happened.)
    I'm sure there's a better (more elegant) way to do this by doing some kind of a query on the database objects and selecting on the public role, but after about half and hour of investigating, I wasn't figuring it out, so I just did it the brute-force method. 
    In case it helps someone else, here's my code.
    CREATE PROCEDURE [dbo].[GrantAccess]
    AS
    DECLARE @AppRoleName AS sysname
    DECLARE AppRoleCursor CURSOR LOCAL SCROLL_LOCKS FOR
    SELECT AppRoleName FROM [dbo].[RoleList];
    OPEN AppRoleCursor
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    WHILE @@FETCH_STATUS = 0
    BEGIN
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_alterdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_creatediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_dropdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagrams] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_renamediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[allocation_units] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assemblies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_references] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[asymmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[certificates] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[change_tracking_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[check_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[computed_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_endpoints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_priorities] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[crypt_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specification_details] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_permissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principal_aliases] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principals] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_role_members] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[default_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[destination_data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[event_notifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[filegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_key_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_catalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_catalog_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_fragments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stoplists] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stopwords] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[function_order_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[identity_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[internal_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_encryptions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[message_type_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[module_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedure_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_functions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_range_values] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_schemes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partitions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[plan_guides] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[remote_service_bindings] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[routes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[schemas] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_message_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contracts] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_message_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queue_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queues] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[services] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_index_tessellations] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_dependencies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[symmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[synonyms] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscolumns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscomments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysconstraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysdepends] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfilegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfiles] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysforeignkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfulltextcatalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysmembers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syspermissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysprotects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysreferences] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[systypes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysusers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[table_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[transmission_queue] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[trigger_events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[triggers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[type_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_attributes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_collections] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_component_placements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_components] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_elements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_facets] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_model_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcard_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcards] TO [' + @AppRoleName + '];' )
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    END
    CLOSE AppRoleCursor
    RETURN 0
    GO
    Once that is in the system, I just needed to "Exec GrantAccess" to make it work.  (Of course, I have a table [RoleList] which contains a "AppRoleName" field that contains the names of the database roles.)
    So, the mystery remains: why did all my users lose their "public" role and why could I not give it back to them?  Was this part of an update to SQL Server 2008 R2?  Was it because I ran another script to delete each user and add them back
    so to refresh their connection with the domain?  Well, this solves the issue for now.
    One last warning: you probably should check the "public" role on your system before running this to make sure there isn't something missing or wrong, here.  It's always possible something is different about your system.
    Hope this helps someone else.

  • The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)

    I have created a user and given him the owner rights for the database.  Though I can LogIn as the user, I cannot access the databases.  I am having the error mesage:
    Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=229&LinkId=20476
    Sha_woop

    Since there are so many possibilities for what might be wrong.  Here's another possibility to look at.  I ran into something where I had set up my own roles on a database.  (For instance, "Administrator", "Manager", "DataEntry", "Customer",
    each with their own kinds of limitations)  The only ones who could use it were "Manager" role or above--because they were also set up as sysadmin because they were adding users to the database (and they were highly trusted).  Also, the users that
    were being added were Windows Domain users--using their domain credentials.  (Everyone with access to the database had to be on our domain, but not everyone on the domain had access to the database--and only a few of them had access to change it.)
    Anyway, this working system suddenly stopped working and I was getting error messages similar to the above.  What I ended up doing that solved it was to go through all the permissions for the "public" role in that database and add those permissions to
    all of the roles that I had created.  I know that everyone is supposed to be in the "public" role even though you can't add them (or rather, you can "add" them, but they won't "stay added").
    So, in "SQL Server Management Studio", I went into my application's database, in other words (my localized names are obscured within <> brackets): "<Computername> (SQL Server <version> - sa)"\Databases\<MyAppDB>\Security\Roles\Database
    Roles\public".  Right-click on "public" and select "Properties".  In the "Database Role Properties - public" dialog, select the "Securables" page.  Go through the list and for each element in the list, come up with an SQL "Grant" statement to
    grant exactly that permission to another role.  So, for instance, there is a scalar function "[dbo].[fn_diagramobjects]" on which the "public" role has "Execute" privilege.  So, I added the following line:
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @RoleName + '];' )
    Once I had done this for all the elements in the "Securables" list, I wrapped that up in a while loop on a cursor selecting through all the roles in my roles table.  This explicitly granted all the permissions of the "public" role to my database roles. 
    At that point, all my users were working again (even after I removed their "sysadmin" access--done as a temporary measure while I figured out what happened.)
    I'm sure there's a better (more elegant) way to do this by doing some kind of a query on the database objects and selecting on the public role, but after about half and hour of investigating, I wasn't figuring it out, so I just did it the brute-force method. 
    In case it helps someone else, here's my code.
    CREATE PROCEDURE [dbo].[GrantAccess]
    AS
    DECLARE @AppRoleName AS sysname
    DECLARE AppRoleCursor CURSOR LOCAL SCROLL_LOCKS FOR
    SELECT AppRoleName FROM [dbo].[RoleList];
    OPEN AppRoleCursor
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    WHILE @@FETCH_STATUS = 0
    BEGIN
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_alterdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_creatediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_dropdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagrams] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_renamediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[allocation_units] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assemblies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_references] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[asymmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[certificates] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[change_tracking_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[check_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[computed_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_endpoints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_priorities] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[crypt_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specification_details] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_permissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principal_aliases] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principals] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_role_members] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[default_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[destination_data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[event_notifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[filegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_key_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_catalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_catalog_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_fragments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stoplists] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stopwords] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[function_order_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[identity_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[internal_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_encryptions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[message_type_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[module_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedure_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_functions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_range_values] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_schemes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partitions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[plan_guides] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[remote_service_bindings] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[routes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[schemas] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_message_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contracts] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_message_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queue_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queues] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[services] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_index_tessellations] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_dependencies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[symmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[synonyms] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscolumns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscomments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysconstraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysdepends] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfilegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfiles] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysforeignkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfulltextcatalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysmembers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syspermissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysprotects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysreferences] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[systypes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysusers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[table_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[transmission_queue] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[trigger_events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[triggers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[type_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_attributes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_collections] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_component_placements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_components] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_elements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_facets] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_model_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcard_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcards] TO [' + @AppRoleName + '];' )
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    END
    CLOSE AppRoleCursor
    RETURN 0
    GO
    Once that is in the system, I just needed to "Exec GrantAccess" to make it work.  (Of course, I have a table [RoleList] which contains a "AppRoleName" field that contains the names of the database roles.)
    So, the mystery remains: why did all my users lose their "public" role and why could I not give it back to them?  Was this part of an update to SQL Server 2008 R2?  Was it because I ran another script to delete each user and add them back so to refresh
    their connection with the domain?  Well, this solves the issue for now.
    One last warning: you probably should check the "public" role on your system before running this to make sure there isn't something missing or wrong, here.  It's always possible something is different about your system.
    Hope this helps someone else.

  • ERROR during creating new Database

    OS: Solaris 10 x86 (10/08)
    Oracle: Release 10.2.0.2.0 - Production (Standard Edition)
    I have just installed Oracle without basic/sample database. I was going to find out how to make it handy.
    What I did:
    # created initeric1.ora file
    control_files = (/oradata/u01/controlfile/control1.ctl,/oradata/u01/controlfile/control2.ctl,/oracle/controlfile/control3.ctl)
    undo_management = AUTO
    undo_tablespace = UNDOTBS1
    db_name = eric1
    db_block_size = 8192
    sga_max_size = 1073741824
    sga_target = 1073741824
    then "startup nomount" end here I stucked.
    I have executed below (all paths exists)
    SQL> create database eric1
    logfile group 1 ('/oradata/u02/redo/redo1.log') size 100M,
    group 2 ('/oradata/u02/redo/redo2.log') size 100M,
    group 3 ('/oradata/u02/redo/redo3.log') size 100M
    character set WE8ISO8859P1
    national character set utf8
    datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management local
    sysaux datafile '/oradata/u02/system/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
    undo tablespace undotbs1 datafile '/oradata/u02/system/undotbs1.dbf' size 100M
    default temporary tablespace temp tempfile '/oradata/u02/system/temp01.dbf' size 100M;
    ...and this is an ERROR:
    create database eric1
    ERROR at line 1:
    ORA-01092: ORACLE instance terminated. Disconnection forced
    Now, I am not sure where I am and what to do next.
    The above "CREATE" created redologs ONLY. Shouold I remove them ( by rm command ?? )and start it again OR somehow to fix it ?
    Little help plz.
    BTW. i was doing steps from this article and stopped in point 5:
    http://www.dba-oracle.com/oracle_create_database.htm
    Edited by: user639256 on 2009-10-24 09:47
    Edited by: user639256 on 2009-10-24 09:48

    Hi,
    here is /oracle/product/10.2.0/db_1/rdbms/log/alert_eric1.log:
    Sat Oct 24 17:52:02 2009
    Starting ORACLE instance (normal)
    Sat Oct 24 17:52:05 2009
    WARNING: Not enough physical memory for SHM_SHARE_MMU segment of size 0x0000000040003000 [flag=0x4000]
    Cannot determine all dependent dynamic libraries for /proc/self/object/a.out
    Unable to find dynamic library libskgxn2.so in search paths
    RPATH = /build/204/lib/:/opt/ORCLcluster/lib/
    LD_LIBRARY_PATH is not set!
    The default library directory is /usr/lib
    Unable to find dynamic library libocr10.so in search paths
    Unable to find dynamic library libocrb10.so in search paths
    RPATH = /build/204/opsm/lib/:/build/204/has/lib/:/build/204/rdbms/lib/
    Unable to find dynamic library libocrutl10.so in search paths
    Unable to find dynamic library libocrutl10.so in search paths
    RPATH = /build/204/opsm/lib/:/build/204/has/lib/:/build/204/rdbms/lib/
    LICENSE_MAX_SESSION = 0
    LICENSE_SESSIONS_WARNING = 0
    Shared memory segment for instance monitoring created
    Picked latch-free SCN scheme 2
    Using LOG_ARCHIVE_DEST_1 parameter default value as /oracle/product/10.2.0/db_1/dbs/arch
    Autotune of undo retention is turned on.
    IMODE=BR
    ILAT =10
    LICENSE_MAX_USERS = 0
    SYS auditing is disabled
    ksdpec: called for event 13740 prior to event group initialization
    Starting up ORACLE RDBMS Version: 10.2.0.2.0.
    System parameters with non-default values:
    sga_max_size = 1073741824
    sga_target = 1073741824
    control_files = /oradata/u01/controlfile/control1.ctl, /oradata/u01/controlfile/control2.ctl, /oracle/controlfile/control3.ctl
    db_block_size = 8192
    undo_management = AUTO
    undo_tablespace = UNDOTBS1
    db_name = eric1
    PMON started with pid=2, OS id=3218
    PSP0 started with pid=3, OS id=3220
    MMAN started with pid=4, OS id=3222
    DBW0 started with pid=5, OS id=3224
    LGWR started with pid=6, OS id=3226
    CKPT started with pid=7, OS id=3228
    SMON started with pid=8, OS id=3230
    RECO started with pid=9, OS id=3232
    MMON started with pid=10, OS id=3234
    MMNL started with pid=11, OS id=3236
    Sat Oct 24 17:52:22 2009
    Oracle Data Guard is not available in this edition of Oracle.
    Sat Oct 24 17:59:20 2009
    create database eric1
    logfile group 1 ('/oradata/u02/redo/redo1.log') size 100M,
    group 2 ('/oradata/u02/redo/redo2.log') size 100M,
    group 3 ('/oradata/u02/redo/redo3.log') size 100M
    character set WE8ISO8859P1
    national character set utf8
    datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management local
    sysaux datafile '/oradata/u02/system/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
    undo tablespace undotbs1 datafile '/oradata/u02/system/undotbs1.dbf' size 100M
    default temporary tablespace temp tempfile '/oradata/u02/system/temp01.dbf' size 100M
    Sat Oct 24 17:59:22 2009
    Database mounted in Exclusive Mode
    Sat Oct 24 17:59:46 2009
    Successful mount of redo thread 1, with mount id 3306637624
    Assigning activation ID 3306637624 (0xc5174938)
    Thread 1 opened at log sequence 1
    Current log# 1 seq# 1 mem# 0: /oradata/u02/redo/redo1.log
    Successful open of redo thread 1
    Sat Oct 24 17:59:48 2009
    SMON: enabling cache recovery
    Sat Oct 24 17:59:49 2009
    create tablespace SYSTEM datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited
    EXTENT MANAGEMENT LOCAL online
    Sat Oct 24 17:59:58 2009
    ORA-19502 signalled during: create tablespace SYSTEM datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited
    EXTENT MANAGEMENT LOCAL online
    Sat Oct 24 17:59:58 2009
    Errors in file /oracle/product/10.2.0/db_1/rdbms/log/eric1_ora_3237.trc:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-19502: write error on file "/oradata/u02/system/system.dbf", blockno 15360 (blocksize=8192)
    ORA-27063: number of bytes read/written is incorrect
    Intel SVR4 UNIX Error: 28: No space left on device
    Additional information: -1
    Additional information: 1048576
    ORA-19502: write error on file "/oradata/u02/system/system.dbf", blockno 15616 (blocksize=8192)
    ORA-27063: number of bytes read/written is incorrect
    Additional information: 466944
    Additional information: 1048576
    Sat Oct 24 17:59:58 2009
    Errors in file /oracle/product/10.2.0/db_1/rdbms/log/eric1_ora_3237.trc:
    ORA-01501: CREATE DATABASE failed
    ORA-01519: error while processing file '?/rdbms/admin/sql.bsq' near line 861
    ORA-00604: error occurred at recursive SQL level 1
    ORA-19502: write error on file "/oradata/u02/system/system.dbf", blockno 15360 (blocksize=8192)
    ORA-27063: number of bytes read/written is incorrect
    Intel SVR4 UNIX Error: 28: No space left on device
    Additional information: -1
    Additional information: 1048576
    ORA-19502: write error on file "/oradata/u02/system/system.dbf", blockno 15616 (blocksize=8192)
    ORA-27063: number of bytes read/written is incorrect
    Additional information: 466944
    Additional information: 1048576
    Error 1519 happened during db open, shutting down database
    USER: terminating instance due to error 1519
    Instance terminated by USER, pid = 3237
    ORA-1092 signalled during: create database eric1
    logfile group 1 ('/oradata/u02/redo/redo1.log') size 100M,
    group 2 ('/oradata/u02/redo/redo2.log') size 100M,
    group 3 ('/oradata/u02/redo/redo3.log') size 100M
    character set WE8ISO8859P1
    national character set utf8
    datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management local
    sysaux datafile '/oradata/u02/system/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
    undo tablespace undotbs1 datafile '/oradata/u02/system/undotbs1.dbf' size 100M
    default temporary tablespace temp tempfile '/oradata/u02/system/temp01.dbf' size 100M...
    Sat Oct 24 18:03:14 2009
    Starting ORACLE instance (normal)
    Sat Oct 24 18:03:16 2009
    WARNING: Not enough physical memory for SHM_SHARE_MMU segment of size 0x0000000040003000 [flag=0x4000]
    Cannot determine all dependent dynamic libraries for /proc/self/object/a.out
    Unable to find dynamic library libskgxn2.so in search paths
    RPATH = /build/204/lib/:/opt/ORCLcluster/lib/
    LD_LIBRARY_PATH is not set!
    The default library directory is /usr/lib
    Unable to find dynamic library libocr10.so in search paths
    Unable to find dynamic library libocrb10.so in search paths
    RPATH = /build/204/opsm/lib/:/build/204/has/lib/:/build/204/rdbms/lib/
    Unable to find dynamic library libocrutl10.so in search paths
    Unable to find dynamic library libocrutl10.so in search paths
    RPATH = /build/204/opsm/lib/:/build/204/has/lib/:/build/204/rdbms/lib/
    LICENSE_MAX_SESSION = 0
    LICENSE_SESSIONS_WARNING = 0
    Picked latch-free SCN scheme 2
    Using LOG_ARCHIVE_DEST_1 parameter default value as /oracle/product/10.2.0/db_1/dbs/arch
    Autotune of undo retention is turned on.
    IMODE=BR
    ILAT =10
    LICENSE_MAX_USERS = 0
    SYS auditing is disabled
    ksdpec: called for event 13740 prior to event group initialization
    Starting up ORACLE RDBMS Version: 10.2.0.2.0.
    System parameters with non-default values:
    sga_max_size = 1073741824
    sga_target = 1073741824
    control_files = /oradata/u01/controlfile/control1.ctl, /oradata/u01/controlfile/control2.ctl, /oracle/controlfile/control3.ctl
    db_block_size = 8192
    undo_management = AUTO
    undo_tablespace = UNDOTBS1
    db_name = eric1
    PMON started with pid=2, OS id=3250
    PSP0 started with pid=3, OS id=3252
    MMAN started with pid=4, OS id=3254
    DBW0 started with pid=5, OS id=3256
    LGWR started with pid=6, OS id=3258
    CKPT started with pid=7, OS id=3260
    SMON started with pid=8, OS id=3262
    RECO started with pid=9, OS id=3264
    MMON started with pid=10, OS id=3266
    MMNL started with pid=11, OS id=3268
    Sat Oct 24 18:03:33 2009
    Oracle Data Guard is not available in this edition of Oracle.
    Sat Oct 24 18:03:56 2009
    create database eric1
    logfile group 1 ('/oradata/u02/redo/redo1.log') size 100M,
    group 2 ('/oradata/u02/redo/redo2.log') size 100M,
    group 3 ('/oradata/u02/redo/redo3.log') size 100M
    character set WE8ISO8859P1
    national character set utf8
    datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management local
    sysaux datafile '/oradata/u02/system/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
    undo tablespace undotbs1 datafile '/oradata/u02/system/undotbs1.dbf' size 100M
    default temporary tablespace temp tempfile '/oradata/u02/system/temp01.dbf' size 100M
    Sat Oct 24 18:03:59 2009
    Errors in file /oracle/product/10.2.0/db_1/rdbms/log/eric1_ora_3269.trc:
    ORA-00200: control file could not be created
    ORA-00202: control file: '/oradata/u01/controlfile/control1.ctl'
    ORA-27038: created file already exists
    Additional information: 1
    Sat Oct 24 18:03:59 2009
    ORA-1501 signalled during: create database eric1
    logfile group 1 ('/oradata/u02/redo/redo1.log') size 100M,
    group 2 ('/oradata/u02/redo/redo2.log') size 100M,
    group 3 ('/oradata/u02/redo/redo3.log') size 100M
    character set WE8ISO8859P1
    national character set utf8
    datafile '/oradata/u02/system/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management local
    sysaux datafile '/oradata/u02/system/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
    undo tablespace undotbs1 datafile '/oradata/u02/system/undotbs1.dbf' size 100M
    default temporary tablespace temp tempfile '/oradata/u02/system/temp01.dbf' size 100M...
    Sat Oct 24 18:56:14 2009
    Shutting down instance: further logons disabled
    Sat Oct 24 18:56:14 2009
    Stopping background process MMNL
    Sat Oct 24 18:56:15 2009
    Stopping background process MMON
    Sat Oct 24 18:56:16 2009
    Shutting down instance (immediate)
    License high water mark = 1
    Sat Oct 24 18:56:16 2009
    ALTER DATABASE CLOSE NORMAL
    ORA-1507 signalled during: ALTER DATABASE CLOSE NORMAL...
    ARCH: Archival disabled due to shutdown: 1089
    Shutting down archive processes
    Archiving is disabled
    Archive process shutdown avoided: 0 active
    ARCH: Archival disabled due to shutdown: 1089
    Shutting down archive processes
    Archiving is disabled
    Archive process shutdown avoided: 0 active
    Edited by: user639256 on 2009-10-24 11:26

  • SQL Server Agent Job And Database Mail - Error formatting query, probably invalid paramters

    We have a stored procedure that we are trying to call with a SQL Server Agent Job. The stored procedure calls Database Mail. This is SQL 2008. The execute task is simply:
    USE [Production]
    GO
    EXEC [dbo].[JOB_EMAIL_SCHEDULED_REPORTS]
    GO
    When the job runs, it is erroring out immediately, with the error:
    Execute as user: NT AUTHORITY\NETWORK SERVICE. Error formatting query, probably invalid paramters [SQLSTATE 42000] (Error 22050). The step failed.
    When we go into SQL Server Manager and just execute the SQL query, it works though. Something within the SQL Server Agent job,  and Database Mail is causing problems. Any ideas? Thanks.

    Justin,
    If you use SSMS then the procedure is executed under a different user when compared to running using a SQL Server Agent Job.
    Isolate the problem by running a SQL Server agent job that sends a mail. Also check if the NT Authority\Network Service account is
    in good standing. Look at the below thread with a similar problem that had an expired account.
    http://social.msdn.microsoft.com/Forums/en/sqltools/thread/bac7ecee-a156-4313-b532-ba15813a0700
    http://SankarReddy.com/

  • Can't connect to the database after 1-2 day, Named Pipes Provider, error: 40,Microsoft SQL Server, Error: 121

    HI
    I have a problem. I can't connect to the database. It said : 
    An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider,
    error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 121)
    When I restart the server, I can connect normally. But after 1-2 days, it can't be connected. 
    How can I fix this?

    Hi Lee,
    Please refer to the following article to configure SQL Server 2005 to allow remote connections:
    http://support.microsoft.com/kb/914277/en-us
    Regards,
    Elvis Long
    TechNet Community Support

  • Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver

    Trying to Install RMS application 13.2.2 and I get past the pre-installation checks and when I get to the Data Source details and enter the data source details with the check box checked to validate the schema/Test Data Source I get the following error:
    Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver. Please check that the library path is set up properly or switch to the JDBC thin client oracle/jdbc/driver/T2CConnection.getLibraryVersioNumber()
    Checks performed:
    RMS Application code location and directory contents:
    [oracle@test-rms-app application]$ pwd
    /binary_files/STAGING_DIR/rms/application
    [oracle@test-rms-app application]$ ls -ltr
    total 144
    -rw-r--r-- 1 oracle oinstall   272 Dec 7  2010 version.properties
    -rw-r--r-- 1 oracle oinstall   405 Jan 16 2011 expected-object-counts.properties
    -rw-r--r-- 1 oracle oinstall   892 May 13 2011 ant.install.properties.sample
    -rw-r--r-- 1 oracle oinstall 64004 Jun  6  2011 build.xml
    drwxr-xr-x 9 oracle oinstall  4096 Jun 16 2011 rms13
    drwxr-xr-x 3 oracle oinstall  4096 Jun 16 2011 installer-resources
    drwxr-xr-x 3 oracle oinstall  4096 Jun 16 2011 antinstall
    drwxr-xr-x 2 oracle oinstall  4096 Jun 16 2011 ant-ext
    drwxr-xr-x 5 oracle oinstall  4096 Jun 16 2011 ant
    -rw-r--r-- 1 oracle oinstall 11324 Dec 18 09:18 antinstall-config.xml.ORIG
    -rwxr-xr-x 1 oracle oinstall  4249 Dec 18 10:01 install.sh
    drwxr-xr-x 4 oracle oinstall  4096 Dec 18 10:06 common
    -rw-r--r-- 1 oracle oinstall 16244 Dec 19 10:37 antinstall-config.xml
    -rw-r--r-- 1 oracle oinstall   689 Dec 19 10:37 ant.install.log
    [oracle@test-rms-app application]$
    Application installation:
    [oracle@test-rms-app application]$ ./install.sh
    THIS IS the driver directory
    Verified $ORACLE_SID.
    Verified SQL*Plus exists.
    Verified write permissions.
    Verified formsweb.cfg read permissions.
    Verified Registry.dat read permissions.
    Verified Java version 1.4.2.x or greater. Java version - 1.6.0
    Verified Tk2Motif.rgb settings.
    Verified frmcmp_batch.sh status.
    WARNING: Oracle Enterprise Linux not detected.  Some components may not install properly.
    Verified $DISPLAY - 172.16.129.82:0.0.
    This installer will ask for your "My Oracle Support" credentials.
    Preparing installer. This may take a few moments.
    Your internet connection type is: NONE
    Integrating My Oracle Support into the product installer workflow...
         [move] Moving 1 file to /binary_files/STAGING_DIR/rms/application
    Installer preparation complete.
    MW_HOME=/u01/app/oracle/Middleware/NewMiddleware1034
    ORACLE_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/as_1
    ORACLE_INSTANCE=/u01/app/oracle/Middleware/NewMiddleware1034/asinst_1
    DOMAIN_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/user_projects/domains/rmsClassDomain
    WLS_INSTANCE=WLS_FORMS
    ORACLE_SID=rmsdbtst
    JAVA_HOME=/u01/app/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0
    Launching installer...
    To make sure I have connectivity from the app server to the database (on a database server) here are the steps followed:
    [oracle@test-rms-app application]$ tnsping rmsdbtst
    TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 19-DEC-2013 10:41:40
    Copyright (c) 1997, 2008, Oracle.  All rights reserved.
    Used parameter files:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test-rms-db.vonmaur.vmc)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = rmsdbtst)))
    OK (0 msec)
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ sqlplus rms13@rmsdbtst
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Dec 19 10:46:18 2013
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ ping test-rms-db
    PING test-rms-db.vonmaur.vmc (192.168.1.140) 56(84) bytes of data.
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=1 ttl=64 time=0.599 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=2 ttl=64 time=0.168 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=3 ttl=64 time=0.132 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=4 ttl=64 time=0.158 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=5 ttl=64 time=0.135 ms
    --- test-rms-db.vonmaur.vmc ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4001ms
    rtt min/avg/max/mdev = 0.132/0.238/0.599/0.181 ms
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ uname -a
    Linux test-rms-app.vonmaur.vmc 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ cat /etc/*-release
    Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)
    Red Hat Enterprise Linux Server release 5.3 (Tikanga)
    [oracle@test-rms-app application]$
    The database is created and all the batch file scripts have been successfully deployed.  Now working on the application server.  The  Weblogic server is installed and 11g forms and reports are installed successfully.
    Any help would be helpful.
    Thanks,
    Ram.

    Please check MOS Notes:
    FAQ: RWMS 13.2 Installation and Configuration (Doc ID 1307639.1)

  • I am geeting problem whem i run bulk insert query i got error Location:_ bcpimp.cpp:1797 Expression:_ cbOutTemp cbOutputStr SPID:__ 52 Process ID:_ 2364 Msg 3624, Level 20, State 1, Line 3 A system assertion check has failed. Check the SQL Server error

    Location: bcpimp.cpp:1797
    Expression: cbOutTemp < cbOutputStr
    SPID: 52
    Process ID: 2364
    Msg 3624, Level 20, State 1, Line 3
    A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to
    Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a QFE from Technical Support. 
    Msg 0, Level 20, State 0, Line 0
    A severe error occurred on the current command.  The results, if any, should be discarded.

    If you check your sql server error log folder you will see dump files created. You need to send those dump files to Microsoft for inspection because outside of microsoft product support the symbols for reading the dumps are not available without which it
    wont be easy to find the issue.
    http://support.microsoft.com/kb/2028589
    In the meantime check if you are on the latest version of Service Pack and if not apply the latest service pack. Majority of these kind of assertions are bugs which are solved in Service Packs/Cumulative Updates.
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Intermittent Error SQL Server Error 67 and 17

    Hi!  We are running Windows SQL Server 2012 Standard on Windows Server 2012.  There is a SQL Database with an Access Front End which we migrated from older versions of Access and SQL.
    The Access front end communicates with the database most of the time without a problem.  However, sometimes Access just stops  responding and then the user gets the following error:
    Connection failed:
    SQLState: '01000'
    SQL Server Error: 67
    [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen(Connect()).
    Connection Failed:
    SQLState: '08001'
    SQL Server Error: 17
    [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access is denied.
    The person who maintains the Access and the SQL Databases provided the following summary:
    The spontaneous issue affects everyone connected to the SQL Server at the same time, and manifests itself in a slow or non-existent connection.  It resolves itself in a few minutes to a few hours.  The ODBC trace did not yield any useful information
    about the problem.  We tested with up to 5 simultaneous users with no problem.  When we observed the issue of Friday, only four users were in the database, and closing these connections did not immediately resolve the issue.  There appeared
    to be no problems with the network for file system access to the server during the down time.
    Based on this information, it definitely is not an issue with MS Access, the ODBC configuration, or the database structure.  It appears to be an intermittent connectivity issue with SQL Server itself, perhaps due to configuration problems, licensing
    (as you mentioned), conflicts with other software/processes, or due to some other SQL Server process.  Unfortunately, this is outside of my expertise and we do not have dedicated SQL Server or IT resources.  
    I had another IT Person look at the issue, he found the following:
    Sally's PC  was getting SQL error.<o:p></o:p>
    Logged into her PC to look at it (logged in as Sally and as cleAdmin)<o:p></o:p>
    Looked at server name, want to verify that in the Control Panel > Adminstratrative Tools > ODBC Connections<o:p></o:p>
    There was no odbc connections under User DSN,  System DSN or Fie DSN<o:p></o:p>
    Created new System DSN connection<o:p></o:p>
    Specified server:  CLE-VM-SQL-FILE\CLESQLSERVER<o:p></o:p>
    The rest were default values<o:p></o:p>
    Clicked test and it was successful<o:p></o:p>
    Unfortunately, the problem started again soon after these changes were made.
    It was suggested there could be a hardware issue, so we have replaced the switch and made sure the drivers on the Network Adapters are current.  Plus
    we have never seen any indication of a loss of network connectivity while testing using a PING Test.
    Has anyone else experienced this issue and if so, how did you solve it?
    Patricia Kachersky

    Bump, Anyone?
    Patricia Kachersky

  • Tons of Cannot Find SQL Server errors in ULS log

    Background: I inherited the maintenance of this farm. The previous consultant migrated the client from WSS 3.0 to 2013 by way of 2007 MOSS and 2010 (unsure of version). I do not know if there was a "temporary" SQL server used during this process
    that no longer exists. It seems likely given all of the errors regarding a missing SQL server.
    The current 2013 Enterprise farm contains 1 WFE and 3 App servers, 2 of which comprise the search topology. There is one SQL server, not aliased. All machines are VMs. One of the search servers (App) is on a different ESXi host. The timer job that is creating
    all of the ULS errors is running on the WFE. Beyond that, the farm has these symptoms:
    It "works" albeit very slowly. Crawl rate of 2-7 dps for both external file shares and the SP content (both with and without Task Offloading / Chimney Offloading enabled). It seems to frequently recycle or take an otherwise long time to render
    in the browser (any page). Finally, it  spews tens of thousands of errors 24x7 on the WFE saying a SQL server (unnamed) cannot be contacted via Named Pipes.
    Specifically: "Unknown SQL Exception 53 occurred. Additional error information from SQL Server is included below.  A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or
    was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)".
    The next error in the sequence is: "An internal error occurred while running a timer job: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that
    the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,
    UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)..."
    This is followed by an error such as this: "There was an internal error invoking the timer job '{E4DDC92E-0056-4E7E-BD3F-1CF5670ACB7D}' for service '{6105D588-FB34-4F1C-82F6-479D7FE146EA}'."
    Of course, each time the timer job mentioned is different. 
    One more error appears consistently with these although not as frequently: "The Execute method of job definition Microsoft.SharePoint.Diagnostics.SPDiagnosticsMetricsProvider (ID 36e6942a-9a80-440f-94a4-e4a606362734) threw an exception. More information
    is included below.  Connection Timeout Expired.  The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.  This could be because the pre-login handshake failed or the server was unable to respond back in
    time.  The duration spent while attempting to connect to this server was - [Pre-Login] initialization=21276; handshake=0;"
    I have been troubleshooting this for days but am not making much progress. How can I determine just what SQL server it says it cannot find and where that server name is stored? It seems like it has to be part of the Timer job configuration since the two
    things are related.

    Hi,
    Thanks for your sharing and have a good day.
    Jason
    Jason Guo
    TechNet Community Support

  • Error while creating database on 10.2 enterprise eidition

    Hi,
    When i trying to create database through batch file on oracle version 10.2 enterprise edition, its giving error.
    ORA-01092: ORACLE instance terminated. Disconnection forced
    Following error message logged in log file:
    ORA-00604: error occurred at recursive SQL level 2
    ORA-00942: table or view does not exist
    Offending statement at line 7032
    create unique index apply$_conf_hdlr_columns_unq1
    on apply$_conf_hdlr_columns(object_number, column_name)
    ORA-01501: CREATE DATABASE failed
    ORA-01519: error while processing file '%ORACLE_HOME%\RDBMS\ADMIN\SQL.BSQ' near line 7032
    ORA-00604: error occurred at recursive SQL level 2
    ORA-00942: table or view does not exist
    The same script is working fine on Oracle 10.1 Enterprise edition But its giving error on Oracle 10.2 Enterprise edition while creating database.
    Please help.
    Thanks in advance

    Hi,
    Content of PFILE:
    # Basic Initialization Parameters
    cluster_database=false
    compatible=10.1.0.2.0
    control_files = ("F:/oracle/oradata/DTO/ctrl01.ctl", "F:/oracle/oradata/DTO/ctrl02.ctl")
    db_block_size=8192
    # db_create_file_dest               # only used in OMF mode
    # db_create_online_log_dest_n          # only used in OMF mode
    db_domain=""
    db_name=DTO
    db_recovery_file_dest=F:/oracle/oradata/DTO/flash_recovery_area
    db_recovery_file_dest_size=2G
    db_unique_name=DTO_01
    # instance_number               # RAC parameter
    job_queue_processes=10
    # log_archive_dest_n               # NOARCHIVELOG mode
    # log_archive_dest_state_n          # NOARCHIVELOG mode
    # nls_language                    # OS dependant
    # nls_territory                    # OS dependant
    open_cursors=50
    pga_aggregate_target=10M
    processes=50
    # remote_listener               # RAC parameter
    remote_login_passwordfile=EXCLUSIVE
    # rollback_segments               # UNDO_MANAGEMENT mode
    # sessions                    # derived from processes
    sga_target=100M
    shared_servers=0
    star_transformation_enabled=FALSE
    undo_management=AUTO
    # undo_tablespace               # first UNDO tablespace
    # Other Parameters
    background_dump_dest=F:/oracle/admin/DTO/bdump
    core_dump_dest=F:/oracle/admin/DTO/cdump
    cursor_sharing=SIMILAR
    db_file_multiblock_read_count=64          
    db_files=400
    db_writer_processes=2
    instance_name=DTO
    log_buffer = 8192
    log_checkpoint_interval = 10000
    log_checkpoint_timeout = 0
    os_authent_prefix=""
    service_names=DTO
    statistics_level=typical
    timed_statistics=true
    user_dump_dest=F:/oracle/admin/DTO/udump
    utl_file_dir=*
    Command in batch script:
    CONNECT sys/oracle AS SYSDBA
    STARTUP NOMOUNT PFILE=&ADMN_DIR/pfile/init&ORA_INST..ora
    CREATE DATABASE &ORA_INST
         CONTROLFILE REUSE
         LOGFILE
              GROUP 1 ('&REDO_DIR_1/redo11.log','&REDO_DIR_2/redo12.log') SIZE 10M REUSE,
              GROUP 2 ('&REDO_DIR_1/redo21.log','&REDO_DIR_2/redo22.log') SIZE 10M REUSE,
              GROUP 3 ('&REDO_DIR_1/redo31.log','&REDO_DIR_2/redo32.log') SIZE 10M REUSE,
              GROUP 4 ('&REDO_DIR_1/redo41.log','&REDO_DIR_2/redo42.log') SIZE 10M REUSE
         DATAFILE
              '&DATA_DIR/syst01.dbf' SIZE 40M REUSE AUTOEXTEND ON NEXT 40M MAXSIZE 2G
              EXTENT MANAGEMENT LOCAL
         SYSAUX DATAFILE
              '&DATA_DIR/saux01.dbf' SIZE 40M REUSE AUTOEXTEND ON NEXT 40M MAXSIZE 2G
         DEFAULT TEMPORARY TABLESPACE temp
              TEMPFILE '&TEMP_DIR/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 2G
              EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M
         UNDO TABLESPACE undo
              DATAFILE '&UNDO_DIR/undo01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 2G,
                   '&UNDO_DIR/undo02.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 2G
         CHARACTER SET AL32UTF8
         SET TIME_ZONE = 'Europe/Warsaw';

  • Error when creating database

    when installing 9i server i couldn't create database and after installation i tried to create database using DBCA but same errors occured.
    it says null sid name error=2. and then says tns protocol problem.
    what should i do?

    Kim Gabrielsen (guest) wrote:
    : Hi,
    : I have tried to install O8 on Linux several times but all have
    : failed. I follow the doc written by Tom Bissett which I find
    very
    : informative on this subject.
    : I have the correct env setting, have created oracle user as
    : member of the dba group and the install program runs nicely
    until
    : it starts to create the database. It stops with an error
    message.
    : The log files look like this (excerpts):
    : CRDBORCL.LST
    : ORA-06413: Connection not open.
    : LCC-00161: Message 161 not found; product=SVRMGR; facility=MGR
    : ORA-06413: Connection not open.
    : create database "ORCL"
    : ORA-03114: not connected to ORACLE
    : ORA-06413: Connection not open.
    : which is the same results I see if I invoke svrmgr manually
    : and tries to connect as 'internal'. BTW srvmgr prompts me for a
    : password even though I'm logged on as 'Oracle' which is a
    member
    : of DBA.
    : INSTALL.LOG
    : - Entering database actions section.
    : - Creating initORCL.ora file
    : - Creating crdb2ORCL.sql database catalog and file
    creation
    : script
    : - ERROR: The 'CREATE DATABASE' statement for the ORCL
    : database failed.
    : egrep failed to find 'ORA-' error in the file:
    : /u01/app/oracle/admin/ORCL/create/crdbORCL.lst
    : I hope someone can help 'cause I'm stock here...
    : Best regards
    : Kim Gabrielsen
    If you followed the instructions on setting the shared memory
    parameters you may have a problem.
    In the 'shmparam.h' file set SHMMAX to something smaller than 4G.
    I just set mine to 2G or 0x7FFFFFFF and now it works fine.
    I have done the Oracle 8.0.5 installation twice now on 2
    different machines with success(1 Compaq Proliant 1500 -
    RH5.2/2.0.36 kernel and 1 GW2K - RH5.2/2.2.1 kernel) I ran into
    several problems along the way but all problems were solvable.
    Mark
    null

Maybe you are looking for

  • Columns adjustment in one row

    Hello, I hope some1 can help me for these. I am using apex 3.1.2 ver My first question: how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling? e.g aaaaaaaaaaaaaaa( ) bbbbbb

  • Select in pl/sql stored proc.

    Hi friends, I am new to oracle development and were trying to write some basic stored procedure,when i try to put a simple stored select statment in between my 'BEGIN' and 'END' clause it never let me do that,it says that 'INTO' clause is expected,I

  • Java.io.File class file

    hi may i know how can i get this java.io.File class file, where can i download it from to use it.

  • PAT blocking IPsec

    Hi, I have problem with Portforwarding and IPsec tunnel: When I set PAT: ip nat inside source static tcp 192.168.10.207 101 WAN_IP 101 extendable then this port is unavailable for remote PCs in other site via IPsec 192.168.7.0. I have also set NAT on

  • I need a sample SOAP over JMS project for JDeveloper

    Does one exist? I am using version 10.1.3.3 of JDeveloper. From everything I have read the only way to do Async Web services for consumption by Oracle's BPEL engine is to do them using JMS. Any information would be appreciated. Have a great day. Terr