SQL - Is running RECONFIGURE dangerous in production - sql

I need to run the following on my production server:
EXEC sp_configure 'xp_cmdshell', 1;
GO
RECONFIGURE;
GO
My question is, Is there any danger running this command in a production environment. Would it drop any connection and would end users notice any down time?

There will be no downtime,
RECONFIGURE specifies that if the configuration setting does not require a server stop and restart, the currently running value should be updated
https://learn.microsoft.com/en-us/sql/t-sql/language-elements/reconfigure-transact-sql
If you use 'with override' it can cause problems. i.e. it will allow you to change settings that you shouldn't change without a restart.
The usual proviso applies, you should test this in a test environment before using it in production.

Related

SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security conf

We have enabled 'XPCmdShellEnabled' on the database serve and we used command shell script in one of the SP which executes on daily job.
(Our Command shell script basically create the directory, create the file and dump the tem table data to csv file).
Issue: From past few days the daily job filing with the below error, before that it was working fine and nobody changed any configurations on server.
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell' search for 'xp_cmdshell' in SQL Server Books Online.
(We have enabled 'XPCmdShellEnabled' = true on 'Surface Area Configuration'.
I have tried again by executing below query, and tried SP.
sp_configure 'show advanced options', '1'
RECONFIGURE
sp_configure 'xp_cmdshell', '1'
RECONFIGURE
But no luck..
Please let me know if anybody aware/faced of this similar type of issue and found solution.
Thanks.

Make config parameters persistent after HANA restart

Each time our HANA DB goes down and comes back up, there are some two parameters that we normally run manually after it is started. I want to write a shell script to automate the execution of these queries when the database restarts.
Any ideas? Here are the two parameters.
ALTER SYSTEM ALTER CONFIGURATION ('global.ini','SYSTEM')
SET('persistence','use_helper_threads_for_flush')='true' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini','SYSTEM')
SET ('persistence','use_helper_threads_for_flush')='false' WITH RECONFIGURE;
This is a bug described in SAP Note 2655468 covering three persistence parameters, and particularly use_helper_threads_for_flush, they have no effect after HANA restart. This is not a normal behavior, since parameters applied with a ALTER SYSTEM ALTER CONFIGURATION WITH RECONFIGURE are active immediately and shouldn't be re-applied.
The workaround here is to re-set the parameter each time HANA restarts or upgrade your HANA release >= 032.00 (SPS03) or higher.
Possible way of automating this is through hdbsql. For example, create new Upstart job (/etc/init) on your HANA server and put these commands in it:
cd /hana/shared/<SID>/hdbclient
su - hdbadm
hdbsql -n localhost -i 00 -u AUSERADMIN -p APassword01
hdbsql -u AUSERADMIN -p APassword01 "ALTER SYSTEM ALTER CONFIGURATION ('global.ini','SYSTEM') SET('persistence','use_helper_threads_for_flush')='true' WITH RECONFIGURE"
hdbsql -u AUSERADMIN -p APassword01 "ALTER SYSTEM ALTER CONFIGURATION ('global.ini','SYSTEM') SET('persistence','use_helper_threads_for_flush')='false' WITH RECONFIGURE"
However, I do not recommend doing this and better stick to upgrade.
Note, that this parameter is internal and shouldn't be used outside of scope of note 2655238

Can not run cmdshell #command in SQL Server Express

I can not run cmdshell #command commands in my SQL Server Express. Is it something to do with the SQL Server version? Should I have to have like SQL Server Standard edition to run this command?
Enable it, as described in the Microsoft article:
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1;
GO
-- To update the currently configured value for advanced options.
RECONFIGURE;
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1;
GO
-- To update the currently configured value for this feature.
RECONFIGURE;
GO
It was a permission issue which is fixed now! Thank you all for the help!

How to Enable Create catalog Option in Integration Services Catalogs?

I want to create a SSIS catalog and the way to create a catalog is to right click on "Integration Services Catalogs" node and select "Create Catalog" option.
But "Create Catalog" option is disable , how to enable this option ?
To check if SSIS installed, open Sql Server Configuration Manager, in the SQL Server Services, is something like 'SQL Server Integration Services ' running?
I had this problem and I found the above solution in belew link:
Can't create a SSISDB catalog due to missing SSISDBBackup.bak file, even though SSIS is installed
Sp_configure 'show advanced options',1;
Go
Reconfigure;
Go
Sp_configure 'clr enabled',1;
Go
Reconfigure
Go
Run the above command from master database

Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server

I'm trying to establish a linked server from SQL Server 2008 R2 to an Access database. The Access database is not password protected. As I have seen in other posts (specifically this one), this is usually due to the current user not having access to the Temp folder inside the NetworkService folder. Since we are running this in Windows Server 2008, the directory structure is quite different than what most are eluding to. I have allowed access to every temp folder in the "root:\Documents and Settings\" directory, and to no avail.
This is the procedure I am using to add the linked server:
EXEC sp_addlinkedserver
#server = N'OS_Access',
#provider = N'Microsoft.ACE.OLEDB.12.0',
#srvproduct = N'',
#datasrc = N'C:\RTBData\Data\OS.mdb';
GO
It creates the linked server with no problem, but I am not able to view the tables/views of the database. Likewise, my ASP.NET application cannot access it either.
I have tried both ACE and JET(64-bit)(by installing the Data Connectivity Components for Office), and they both do not work. I have also tried configuring the ACE provider with "Dynamic Parameter" and "Allow InProcess" to true.
Additionally, I tried upping the memory usage by the MSSQLSERVER services by adding "-g512;" in front of "startup parameters" string in SQL configuration manager to rule out memory issues.
If anyone could shed some light on this that would be fantastic! Thanks!
UPDATE: I logged into SQL using the sa account, and I was able to view the linked server. My current user account has full permissions in SQL server, so I am unsure of what the difference is between the accounts. Maybe I gave permissions to the wrong Temp folder, in which the sa account (being built-in) has access to. If someone could point me in the right direction here, that would be great, and I think it would also help a lot of other people.
I fixed the problem by disabling UAC within the control panel. I am unsure what changes this made, but it might help others!
USE [master]
GO
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO
USE [master]
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1
GO
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Name & Location of DB';;, [TableName])