This guide explains how to build an infrastructure for hosting Microsoft SQL Server Database as a Service (DBaaS). By using the features of SQL Server 2014 and Hyper-V virtual machines with Microsoft System Center 2012, a hosting service provider can start with very small tenant databases and scale to meet the needs of the largest and busiest SQL Server applications.
This reference architecture includes information about hardware, software, system design, and component configuration
Downland using below link
SQL Server 2014: Database as a Service Reference Architecture Guide
http://www.microsoft.com/en-us/download/confirmation.aspx?id=39295
Regards
Satishbabu Gunukula
Thursday, April 16, 2015
Wednesday, April 1, 2015
Enable and Disable xp_cmdshell using SP_CONFIGURE
You can enable or disable xp_cmdshell by using the Policy-Based Management or by executing sp_configure. This option enables system adms to control wheather the xp_cmdshell extended stored procedure can be executed on a system.
By default this is option is disabled on a new installation.
How to enable:
-- 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
-- Enable xp_cmdshell feature
EXEC sp_configure 'xp_cmdshell', 1;
GO
-- To update the currently configured value for this feature.
RECONFIGURE;
GO
** User might receive below errow when excuting sp_configure command
EXEC sp_configure ‘show advanced options’,1
GO
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '‘'.
Note that the syntax is correct, but you might have used wrong character quote.
Run below query to check feature ENABLED or not.
SELECT * FROM SYS.CONFIGURATIONS WHERE Name = 'xp_cmdshell'

How to disable:
-- 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
-- Disable xp_cmdshell feature
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
Run below query to check feature DISABLED or not.
SELECT * FROM SYS.CONFIGURATIONS WHERE Name = 'xp_cmdshell'
** Users might receive below error when executing RECONFIGURE command.
Msg 5808, Level 16, State 1, Line 1
Ad hoc update to system catalogs is not supported.
Note that some configuration options require a server stop and restart to update the currently running value." By using “WITH OVERRIDE” you should be able to run successfully.
RECONFIGURE WITH OVERRIDE;
GO
Command(s) completed successfully.
Regards
Satishbabu Gunukula
http://www.sqlserver-expert.com.
By default this is option is disabled on a new installation.
How to enable:
-- 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
-- Enable xp_cmdshell feature
EXEC sp_configure 'xp_cmdshell', 1;
GO
-- To update the currently configured value for this feature.
RECONFIGURE;
GO
** User might receive below errow when excuting sp_configure command
EXEC sp_configure ‘show advanced options’,1
GO
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '‘'.
Note that the syntax is correct, but you might have used wrong character quote.
Run below query to check feature ENABLED or not.
SELECT * FROM SYS.CONFIGURATIONS WHERE Name = 'xp_cmdshell'

How to disable:
-- 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
-- Disable xp_cmdshell feature
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
Run below query to check feature DISABLED or not.
SELECT * FROM SYS.CONFIGURATIONS WHERE Name = 'xp_cmdshell'
** Users might receive below error when executing RECONFIGURE command.
Msg 5808, Level 16, State 1, Line 1
Ad hoc update to system catalogs is not supported.
Note that some configuration options require a server stop and restart to update the currently running value." By using “WITH OVERRIDE” you should be able to run successfully.
RECONFIGURE WITH OVERRIDE;
GO
Command(s) completed successfully.
Regards
Satishbabu Gunukula
http://www.sqlserver-expert.com.
Thursday, December 4, 2014
How to remove Column Header and White spaces in output file
I come across a requirement that I need to create a job on a SQLServer database and generate output separated by a pipe ("|" ) symbol for each column. Also remove all the white spaces between the columns.
As the requirement is to load the data into an ERP system. I found an easy solution using "sqlcmd"
use -W option to remove white spaces
use -h-1 option to remove column heading or header.
Here is the syntax:-
c:\> sqlcmd -W -h-1 -S <Server_name>,<port> -U <user>-P <password> test -i "c:\query.sql" -o "c:\output.txt"
Where
query.sql - where you will be writing the query
for ex:- select @@version
I would recommend to use "set nocount on" in the query.sql to suppress the record count.
output.txt - where you will see the clean output
Hope this helps.
Regards,
Satishbabu Gunukula
As the requirement is to load the data into an ERP system. I found an easy solution using "sqlcmd"
use -W option to remove white spaces
use -h-1 option to remove column heading or header.
Here is the syntax:-
c:\> sqlcmd -W -h-1 -S <Server_name>,<port> -U <user>-P <password> test -i "c:\query.sql" -o "c:\output.txt"
Where
query.sql - where you will be writing the query
for ex:- select @@version
I would recommend to use "set nocount on" in the query.sql to suppress the record count.
output.txt - where you will see the clean output
Hope this helps.
Regards,
Satishbabu Gunukula
How to add Date and Time to output file for Jobs
In one of my project I come across this requirement that setup a job to run every hour and the output must have a Date and Time.
I found couple of solutions
1. When using SQLServer Management Studio(SSMS) you can add below syntax for output file
SSMS--> SQL Server Agent --> Job Name--> Properties --> Steps --> Select "edit" --> Advanced
$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME))
For exL:-
D:\SQLBackup\ouput_file$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt
2. Use Tokens in Job setup
Refer below MSDN doc
http://msdn.microsoft.com/en-us/library/ms175575.aspx
3. use %date% format with sqlcmd
for ex:-
sqlcmd -S sqlserver,port -U <user> -P <password> -i "c:\query.sql" -o "c:\ouput_%date%.txt"
You can play around %date% format if you are looking for specific date format.
Regards
Satishbabu Gunukula
I found couple of solutions
1. When using SQLServer Management Studio(SSMS) you can add below syntax for output file
SSMS--> SQL Server Agent --> Job Name--> Properties --> Steps --> Select "edit" --> Advanced
$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME))
For exL:-
D:\SQLBackup\ouput_file$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt
2. Use Tokens in Job setup
Refer below MSDN doc
http://msdn.microsoft.com/en-us/library/ms175575.aspx
3. use %date% format with sqlcmd
for ex:-
sqlcmd -S sqlserver,port -U <user> -P <password> -i "c:\query.sql" -o "c:\ouput_%date%.txt"
You can play around %date% format if you are looking for specific date format.
Regards
Satishbabu Gunukula
Tuesday, November 18, 2014
How to find the Data and Log File location of all the Databases
D: disk is at or near capacity. You may need to delete some files
I know that databases are not growing that fast. I released some space by clear the log files, but it didn’t help much.
When I looked into the data and log file folders I see log of files with very old date. It looks like somebody got deleted the database but never cleared the files.
In this situation make sure you first get a list of data and log files with location using below SQL Query then proceed with cleaning the old files.
SELECT Name,Physical_Name AS File_Location
FROM sys.master_files
To find disk space allocate and fee space in SQLServer use below command.
SELECT Name, Filename,
CONVERT(Decimal(15,2),ROUND(a.Size/128.000,2)) [Currently
Allocated Space (MB)],
CONVERT(Decimal(15,2),ROUND(FILEPROPERTY(a.Name,'SpaceUsed')/128.000,2)) AS [Space Used (MB)],
CONVERT(Decimal(15,2),ROUND((a.Size-FILEPROPERTY(a.Name,'SpaceUsed'))/128.000,2)) AS [Available Space (MB)]
FROM dbo.sysfiles a (NOLOCK)
The above SQL provided Name of the Data and log file, File name with Location, Currently Allocated space, Space Used and Available space in SQL Server.
Regards
Satishbaub Gunukula
Subscribe to:
Posts (Atom)