<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>database security &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/database-security/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 25 Sep 2016 19:49:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Encrypted DDL Trigger to Track all Database Changes</title>
		<link>https://www.dbrnd.com/2016/10/sql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security/</link>
					<comments>https://www.dbrnd.com/2016/10/sql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 21 Oct 2016 16:16:57 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DDL Trigger]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Track Object]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3674</guid>

					<description><![CDATA[I know, you guys are thinking that why we require DDL Trigger to track database changes in SQL Server. SQL Server already has Changed Data Capture (CDC) and Audit option. When we are talking about DDL Trigger, compare to other automated process this manual process is still preferred by SQL DBA because It is easy [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&amp;linkname=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&amp;linkname=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&amp;linkname=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&amp;linkname=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&amp;linkname=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&amp;linkname=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security%2F&#038;title=SQL%20Server%3A%20Encrypted%20DDL%20Trigger%20to%20Track%20all%20Database%20Changes" data-a2a-url="https://www.dbrnd.com/2016/10/sql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security/" data-a2a-title="SQL Server: Encrypted DDL Trigger to Track all Database Changes"></a></p><p>I know, you guys are thinking that why we require DDL Trigger to track database changes in SQL Server. </p>
<blockquote><p>SQL Server already has Changed Data Capture (CDC) and Audit option.<br />
When we are talking about DDL Trigger, compare to other automated process this manual process is still preferred by SQL DBA because It is easy to use and manage.</p></blockquote>
<blockquote><p>A Database Administrator is also responsible for all different types of Database Security like: Database / Schema / Object level permission, Tracking object creation. </p></blockquote>
<blockquote><p>I have enabled SQL Server Audit for one of our production report server, but some time It does not work as per the expectation.
</p></blockquote>
<blockquote><p>I have searched the alternate solution and found that we can create DDL trigger on a database to track the DDL operation of different objects.<br />
We can also use DDL triggers to verify the result of SQL Server Audit. </p></blockquote>
<p><strong>Other take care points of DDL Trigger are:</strong></p>
<blockquote><p>Only SA or Admin user has to perform this stuff. The DBA should restrict other common database user to view or modify the DDL trigger.</p></blockquote>
<blockquote><p>It should be encrypted. </p></blockquote>
<blockquote><p>If our database is heavily loaded with tons of transaction, we should not create any type of DDL trigger on it. </p></blockquote>
<p>Here, I am creating one encrypted DDL Trigger which tracks different types of object like:<br />
Stored Procedure, Table, View, Function, Trigger, Sequence, Index.</p>
<p><strong>Step to create Encrypted DDL Trigger:</strong></p>
<p><strong>First Create separate database:</strong></p>
<pre class="crayon-plain-tag">CREATE DATABASE [DDLChanges]
GO</pre> </p>
<p><strong>Create one table which will hold all event information:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE [DDLChanges].[dbo].[tbl_TrackDDLChanges](
	[EventDate] [datetime] NOT NULL DEFAULT (getdate()),
	[EventType] [nvarchar](64) NULL,
	[EventDDL] [nvarchar](max) NULL,
	[LoginName] [nvarchar](255) NULL,
	[DatabaseName] [nvarchar](255) NULL,
	[SchemaName] [nvarchar](255) NULL,
	[ObjectName] [nvarchar](255) NULL,
	[HostName] [varchar](64) NULL,
	[IPAddress] [varchar](32) NULL,
	[ProgramName] [nvarchar](255) NULL,
	[EventXML] [xml] NULL
)
GO</pre> </p>
<p><strong>SELECT your application Database and create below encrypted DDL trigger:</strong></p>
<blockquote><p>If you require to enable DDL trigger on multiple database, execute DDL trigger one by one on each require a database. </p></blockquote>
<blockquote><p>Please do not create a DDL Trigger on [DDLChanges] database, that we have created in the first step which is for tracking purposes.</p></blockquote>
<blockquote><p>Now, perform any DDL action on your database and check [DDLChanges].[dbo].[tbl_TrackDDLChanges] table where you can find important information like: which SQL Query, who created, which host, what time, on which database and other. </p></blockquote>
<pre class="crayon-plain-tag">CREATE TRIGGER [trg_DDL_Changes]
ON DATABASE
WITH ENCRYPTION
FOR 
	CREATE_PROCEDURE
	,ALTER_PROCEDURE
	,DROP_PROCEDURE
	,CREATE_TABLE
	,ALTER_TABLE
	,DROP_TABLE
	,CREATE_VIEW
	,ALTER_VIEW
	,DROP_VIEW
	,CREATE_FUNCTION
	,ALTER_FUNCTION
	,DROP_FUNCTION
	,CREATE_TRIGGER
	,ALTER_TRIGGER
	,DROP_TRIGGER
	,CREATE_SEQUENCE
	,ALTER_SEQUENCE
	,DROP_SEQUENCE
	,CREATE_INDEX
	,ALTER_INDEX
	,DROP_INDEX
AS
BEGIN
    SET NOCOUNT ON;
    DECLARE
        @EventData XML = EVENTDATA(); 
    DECLARE 
        @ip VARCHAR(32) =
        (
            SELECT client_net_address
            FROM sys.dm_exec_connections
            WHERE session_id = @@SPID
        );
 
    INSERT DDLChanges.dbo.tbl_TrackDDLChanges
    (
        EventType
        ,EventDDL
	,LoginName        
        ,DatabaseName
        ,SchemaName
        ,ObjectName
        ,HostName
        ,IPAddress
        ,ProgramName        
	,EventXML
    )
    SELECT
        @EventData.value('(/EVENT_INSTANCE/EventType)[1]','NVARCHAR(100)')
        ,@EventData.value('(/EVENT_INSTANCE/TSQLCommand)[1]','NVARCHAR(MAX)')
	,SUSER_SNAME()        
        ,DB_NAME()
        ,@EventData.value('(/EVENT_INSTANCE/SchemaName)[1]','NVARCHAR(255)')
        ,@EventData.value('(/EVENT_INSTANCE/ObjectName)[1]','NVARCHAR(255)')
        ,HOST_NAME()
        ,@ip
        ,PROGRAM_NAME()        
	,@EventData
END
GO</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/10/sql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-6)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 23 Jul 2016 14:09:23 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dynamic data masking]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[row level security]]></category>
		<category><![CDATA[secure view column]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3397</guid>

					<description><![CDATA[How do you grant a SQL Server developer truncate table permission without giving them the ability to alter the table? This is accomplished by a DBA creating a stored procedure with the TRUNCATE TABLE statements and then granting execute permission on the stored procedure to those who need it. I have a table where some [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-6)"></a></p><p><strong>How do you grant a SQL Server developer truncate table permission without giving them the ability to alter the table?</strong></p>
<blockquote><p>This is accomplished by a DBA creating a stored procedure with the TRUNCATE TABLE statements and then granting execute permission on the stored procedure to those who need it.</p></blockquote>
<p><strong>I have a table where some of the columns should not be queryable by all users. How can I filter the data appropriately, so that not everyone can select the data?</strong></p>
<blockquote><p>One of the easiest ways to do this is through the use of views.</p>
<p>If we can use a view, we can successfully filter the data and grant the users access to the view, we can present just the data we want the users to have access to.</p>
<p>however, there are two requirements for this:</p>
<ul>
<li>The users do not already have the ability to select data from the table.</li>
<li>A view can be created where an ownership chain can be established with the table.</li>
</ul>
</blockquote>
<p><strong>How to grant only few columns without creating views?</strong></p>
<p>We can assign column list to table.</p><pre class="crayon-plain-tag">GRANT SELECT ON dbo.Employee (EmployeeID, FirstName, MiddleName, SurName) TO HR_Intern;</pre><p>
<strong>I can create Stored Procedure, but However, when I went to execute the stored procedure, SQL Server told me I didn&#8217;t have permission to do so. Is this a bug or did I do something wrong?</strong></p>
<blockquote><p>This is entirely possible if you have the ability to create a stored procedure in a schema you don&#8217;t own.</p>
<p>In this particular case we&#8217;ve created a role that has the ability to create stored procedures in the database and the ability to alter the dbo schema. By default, the dbo schema is owned by the database owner.</p></blockquote>
<p><strong>What do you know about the SQL Server 2016 Row Level Security?</strong></p>
<blockquote><p>SQL Server 2016 has introduced Row Level Security (RLS) which is a feature that enables fine grained control over access to rows in a table. RLS allows you to easily control which users can access which data with complete transparency to the application.This enables us to easily restrict the data based on the user identity or security context.</p>
<p>Row-Level Security enables customers to control access to rows in a database table based on the characteristics of the user executing a query.</p></blockquote>
<p><strong>Which are the different predicates support by Row Level Security?</strong></p>
<blockquote><p>RLS supports two types of security predicates.</p>
<p>Filter predicates silently filter the rows available to read operations (SELECT, UPDATE, and DELETE).</p>
<p>Block predicates explicitly block write operations (AFTER INSERT, AFTER UPDATE, BEFORE UPDATE, BEFORE DELETE) that violate the predicate.</p></blockquote>
<p><strong>What do you know about the Dynamic Data Masking?</strong></p>
<blockquote><p>Dynamic data masking limits sensitive data exposure by masking it to non-privileged users. Dynamic data masking helps prevent unauthorized access to sensitive data by enabling customers to designate how much of the sensitive data to reveal with minimal impact on the application layer. It’s a data protection feature that hides the sensitive data in the result set of a query over designated database fields, while the data in the database is not changed.</p>
<p>For example, a call center support person may identify callers by several digits of their social security number or credit card number, but those data items should not be fully exposed to the support person. A masking rule can be defined that masks all but the last four digits of any social security number or credit card number in the result set of any query.</p></blockquote>
<p>What should be the characteristics for strong password?</p>
<ul>
<li>Is at least 8 characters long.</li>
<li>Combines letters, numbers, and symbol characters within the password.</li>
<li>Is not found in a dictionary.</li>
<li>Is not the name of a command.</li>
<li>Is not the name of a person.</li>
<li>Is not the name of a user.</li>
<li>Is not the name of a computer.</li>
<li>Is changed regularly.</li>
<li>Is significantly different from previous passwords.</li>
</ul>
<p><strong>How SQL Injection Works?</strong></p>
<blockquote><p>The primary form of SQL injection consists of direct insertion of code into user-input variables that are concatenated with SQL commands and executed. A less direct attack injects malicious code into strings that are destined for storage in a table or as metadata. When the stored strings are subsequently concatenated into a dynamic SQL command, the malicious code is executed.</p>
<p>The injection process works by prematurely terminating a text string and appending a new command. Because the inserted command may have additional strings appended to it before it is executed, the malefactor terminates the injected string with a comment mark &#8220;&#8211;&#8220;. Subsequent text is ignored at execution time.</p></blockquote>
<p><strong>What are your best practices to avoid SQL Injection?</strong></p>
<ul>
<li>Validate all input.</li>
<li>Use Type-Safe SQL Parameters.</li>
<li>Use Parameterized Input with Stored Procedures.</li>
<li>Wrapping Parameters with QUOTENAME() and REPLACE().</li>
<li>Use the Parameters Collection with Dynamic SQL.</li>
</ul>
<p><strong>How Do You Determine What Data Are Confidential?</strong></p>
<ul>
<li>We should to contact our legal department (if there is one), an attorney, or law professor, if in doubt about data.</li>
<li>Ask about, What type of data should we be extra cautious about?</li>
<li>Ask government officials or look at government websites on the industry we are in.</li>
<li>We should think like a hacker.</li>
</ul>
<p><strong>Have you seen any performance hit using SQL Server Transparent Data Encryption (TDE)?</strong></p>
<blockquote><p>Given that you are performing more operations, there is some. One advantage to TDE is that the data is only encrypted in disk. So if it&#8217;s in SQL Server&#8217;s memory buffers, there&#8217;s no repeated decryption going on.</p></blockquote>
<p><strong>Any concerns about the SQL Server public database role?</strong></p>
<blockquote><p>Yes, the general recommendation is to avoid using the public role. Every database user is a member of public. As a result, any permissions assigned to it are also assigned to every database user.</p></blockquote>
<p><strong>What do you use to avoid the SQL Server fixed server roles?</strong></p>
<blockquote><p>The recommended practice is to create a role and assign explicit permissions.</p>
<p>A developer wants to execute a SQL Server stored procedure in debug mode. I believe SQL Server sysadmin level access required to use debug mode. I don&#8217;t want to give sysadmin access to the developer. Is there any I can handle this without giving sysadmin access?</p>
<p>Unfortunately, there is not. Debugging requires sysadmin role membership.</p></blockquote>
<p><strong>Is it possible to grant linked server permissions to Windows user group?</strong></p>
<blockquote><p>Yes: A Windows group is no different from any other login.</p></blockquote>
<p><strong>T-SQL Script to find mismatched between Database Login and Server Login.</strong></p><pre class="crayon-plain-tag">SELECT d.[name] AS 'DB User', s.[name] AS 'Login', s.sid AS 'SID'
FROM sys.database_principals d
 JOIN sys.server_principals s
 ON d.sid = s.sid
WHERE d.[name] &lt;&gt; s.[name];</pre><p>
<strong><br />
What is the main hierarchy of Permissions?</strong><br />
<a href="https://msdn.microsoft.com/en-us/library/ms191465.aspx" target="_blank">Please visit this Microsoft official documents:</a></p>
<p><strong>What should be your common practice for SQL Server Security?</strong></p>
<ul>
<li>SQL Server should be hardened after the installation.</li>
<li>After the installation, use the SQL Server Configuration Manager tool in order to disable unnecessary features and services.</li>
<li>Install only required components.</li>
<li>Recent service packs and critical fixes should be installed for SQL Server and Windows.</li>
<li>Windows Authentication mode is more secure than SQL Authentication.</li>
<li>If there is still a need to use SQL Authentication – enforce strong password policy.</li>
<li>Disable the SA account and rename it. Do not use this account for SQL server management.</li>
<li>Change default SQL Server ports associated with the SQL Server installation to keep hackers from port scanning the server.</li>
<li>Hide SQL Server instances or disable the SQL Server Browser service.</li>
<li>Remove BUILDIN\Administrators group from the SQL Server Logins.</li>
<li>Enable logging SQL Server login attempts (failed &amp; successful).</li>
<li>Defining Database Ownership to Increase Security.</li>
<li>Disabling certain system stored procedures.</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-5)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/</link>
					<comments>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 22 Jul 2016 14:06:57 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[deny]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[sql server audit]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[XP_CMDSHELL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3378</guid>

					<description><![CDATA[What do you know about the SQL Server Audit? SQL Server Audit is used to track and log events (not data change) occurring on the SQL Server. SQL Server uses extended events to help create an audit. The audit can be server level or database level. If you create an audit on a database table, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-5)"></a></p><p><strong>What do you know about the SQL Server Audit?</strong></p>
<blockquote><p>SQL Server Audit is used to track and log events (not data change) occurring on the SQL Server. SQL Server uses extended events to help create an audit. The audit can be server level or database level.</p>
<p>If you create an audit on a database table, SQL Server will only track the events that trigger the certain operations (SELECT/INSERT/UPDATE/DELETE) defined in the database audit specification.</p></blockquote>
<p><strong>What options are available to audit login activity?</strong></p>
<ul>
<li>Custom solution with your application to log all logins into a centralized table</li>
<li>Enable login auditing at the instance level in Management Studio</li>
<li>Execute Profiler to capture logins into the instance</li>
<li>Leverage a third party product</li>
</ul>
<p><strong>What is Audit in SQL Server?</strong></p>
<blockquote><p>Auditing an instance of the SQL Server Database Engine or an individual database involves tracking and logging events that occur on the Database Engine.</p></blockquote>
<p><strong>What is Server level Audit specification?</strong></p>
<blockquote><p>You can create one server audit specification per audit.</p>
<p>The server audit specification collects many server-level action groups raised by the Extended Events feature. You can include audit action groups in a server audit specification. Audit action groups are predefined groups of actions, which are atomic events occurring in the Database Engine.</p></blockquote>
<p><strong>What is Database level Audit specification?</strong></p>
<blockquote><p>You can create one database audit specification per SQL Server database per audit.</p>
<p>The database audit specification collects database-level audit actions raised by the Extended Events feature. You can add either audit action groups or audit events to a database audit specification.</p></blockquote>
<p><strong>Is it good to enable Audit only for SQL Server Login fails?</strong></p>
<blockquote><p>Yes:</p>
<p>Database administrators should enable login auditing feature of SQL Server on all instances which they manage. Once this feature is enabled SQL Server will write all the failed and successful login information in SQL Server Error Logs. It is always a best practice to auditing failed SQL Server logins.</p></blockquote>
<p><strong>Does SQL Server Audit require any additional permission?</strong></p>
<blockquote><p>Yes:</p>
<p>Each feature and command for SQL Server Audit has individual permission requirements.</p></blockquote>
<p><strong>Should we encrypt the SQL Server datatabase backups?</strong></p>
<blockquote><p>Yes:</p>
<p>We need to make sure the database backups are encrypted to avoid the misuse.</p></blockquote>
<p><strong>Why we should not use tha SA login for all the different SQL Server access?</strong></p>
<blockquote><p>Because, the sa login and password to all of your SQL Servers because auditing the sa login with a shared password is difficult without capturing the host name or some other personally identifiable data. We should migrate all SQL Server authentication to Windows based authentication.</p></blockquote>
<p><strong>Can I stop a System Admin from enabling SQL Server xp_cmdshell?</strong></p>
<blockquote><p>No:</p></blockquote>
<p><strong>T-SQL script to disable the SA login</strong></p><pre class="crayon-plain-tag">ALTER LOGIN sa DISABLE;</pre><p>
<strong>T-SQL script to rename the SQ login.</strong></p><pre class="crayon-plain-tag">ALTER LOGIN sa WITH NAME = [dbrnd_user];</pre><p>
<strong>Please do auto reset the SA password and disable it.</strong></p>
<blockquote><p>SQL Server has an undocumented system stored procedure named sp_SetAutoSAPasswordAndDisable. This procedure will do exactly as the name suggests: it will reset the password and then disable the &#8216;sa&#8217; login.</p></blockquote>
<pre class="crayon-plain-tag">EXEC sp_SetAutoSAPasswordAndDisable
GO</pre>
<strong>T-SQL script to find common passwords.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE('mssqltips',password_hash)=1;</pre>
<strong>T-SQL script to find blank passwords.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE('',password_hash)=1;</pre>
<strong>T-SQL script to find Passwords that are the same as the Login name.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE(name,password_hash)=1;</pre>
<strong>What is GRANT, DENY and REVOKE?</strong></p>
<blockquote><p>GRANT:gives a user permission to perform certain tasks on database objects.<br />
DENY:denies any access to a user to perform certain tasks on database objects.<br />
REVOKE:removes a grant or deny permission from a user on certain database objects.</p></blockquote>
<p><strong>Sample T-SQL scripts for GRANT, DENY and REVOKE.</strong><br />
<pre class="crayon-plain-tag">GRANT INSERT, UPDATE, SELECT ON Customers TO Joe, Mary;
DENY DELETE ON Customers to Joe, Mary;
REVOKE UPDATE ON Customers to Joe;</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-4)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 21 Jul 2016 21:00:34 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Hashing function]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Symmetric encryption]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[WITH ENCRYPTION OPTION]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3375</guid>

					<description><![CDATA[In our organization we have two teams that stored encrypted data in Microsoft SQL Server. The data is encrypted using symmetric keys and those keys are encrypted with passwords. However, we have a director who needs to be able to see the data for both teams, but we&#8217;d like it so that he only has [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-4)"></a></p><p><strong>In our organization we have two teams that stored encrypted data in Microsoft SQL Server. The data is encrypted using symmetric keys and those keys are encrypted with passwords. However, we have a director who needs to be able to see the data for both teams, but we&#8217;d like it so that he only has to remember one password, preferably separate from the passwords used by the two teams. Is that possible?</strong></p>
<blockquote><p>Yes, it is. Microsoft SQL Server supports the ability for encryption keys to be encrypted via multiple mechanisms. For instance, a symmetric key can be encrypted with a password and an asymmetric key. If you have access to the symmetric key and at least one of those mechanisms, you can open the key.</p></blockquote>
<p><strong>What is hash function?</strong></p>
<blockquote><p>A hash function takes in data and returns back a fixed length block of bits such that any change to the data should result in a different block.</p></blockquote>
<p><strong>What do you know about the HASHBYTES()?</strong></p>
<blockquote><p>HASHBYTES(), as the name implies, is a function or algorithm that generates a hash from some input.</p></blockquote>
<p><strong>Which are the different hashing algorithms?</strong></p>
<blockquote><p>MD2, MD4, MD5, SHA-0, SHA-1, SHA-2</p></blockquote>
<p><strong>What is the main limitation of hasing function?</strong></p>
<blockquote><p>Since a hash function will return a fixed length block, obviously, there are a finite set of possibilities for the output. Therefore, there&#8217;s bound to be different inputs that will result in the same output. We call these situations collisions. What is of concern is if a collision can be engineered fairly quickly/cheaply. This is referred to as a collision attack.</p></blockquote>
<p><strong>What do you know about the Symmetric Encryption Algorithm?</strong></p>
<blockquote><p>This algorithm either take unencrypted data and return encrypted data, or they take encrypted data and return unencrypted data. In order to do so, they use a key, and the key is the same regardless of which direction you go. When it comes to encryption algorithms, symmetric encryption algorithms are substantially faster than asymmetric algorithms.</p></blockquote>
<p><strong>What are the different type of Symmetric Encryption Algorithms?</strong></p>
<ul>
<li>DES (DES)</li>
<li>Triple DES with 128 bit key (TRIPLE_DES)</li>
<li>Triple DES with 192 bit key (DESX)</li>
<li>RC2 (RC2)</li>
<li>RC4 (RC4)</li>
<li>RC4 with 128 bit key (RC4_128)</li>
<li>AES with 128 bit key (AES_128)</li>
<li>AES with 192 bit key (AES_192)</li>
<li>AES with 256 bit key (AES_256)</li>
</ul>
<p><strong>What is your common practice with account SA?</strong></p>
<ul>
<li>Set a hard to guess password.</li>
<li>Rename sa.</li>
<li>Disable sa.</li>
<li>Ensure that no other accounts exist named sa.</li>
</ul>
<p><strong>A user asked how they could get an alert whenever a login failed due to the account being locked out?</strong></p>
<ul>
<li>A SQL Server Agent alert, using the WMI event AUDIT_LOGIN_FAILED</li>
<li>Event Notifications, also using AUDIT_LOGIN_FAILED</li>
<li>Manually consuming the error log</li>
</ul>
<p><strong>How to hide your SQL Server code?</strong></p>
<blockquote><p>The WITH ENCRYPTION clause is used to encrypt the definition of SQL Server objects (views, stored procedures, functions ), so that no one may be able to view the definition/code of that specific object. Using the clause while creating an object is fairly easy.</p></blockquote>
<p><strong>What is the main disadvantage of WITH ENCRYPTION option to hide the SQL Server code?</strong></p>
<blockquote><p>The definition/code of object will not be available to anyone regardless of their permissions or access level. You can not customize the permissions for code/definition visibility.</p>
<p>Once an object has been created on the server using the WITH ENCRYPTION option, there is no standard method provided to get the definition/code back out of the encrypted object. You will need to keep a copy of the code outside of SQL Server.</p></blockquote>
<p><strong>What is the alternative of WITH ENCRYPTION oprtion to secure the SQL Server code?</strong></p>
<blockquote><p>The simple alternative is to granting or revoking View Definition rights.</p>
<p>If permission View Definition is denied for an object to any user then the user would not be able to view the object in SSMS or view.</p></blockquote>
<p><strong>What is a Salt?</strong></p>
<blockquote><p>It is basically something added to whatever we&#8217;re trying to encrypt to make it harder to decrypt the data (two way functions, like symmetric and asymmetric key functions) or find a collision (one way functions, AKA hash functions). The salt should be potentially different for every single piece of encrypted data. The salt should be randomly generated.</p></blockquote>
<p><strong>What will you do if you lost rights of your SQL Server instance?</strong></p>
<ul>
<li>Dedicated Administrator Connection</li>
<li>BUILIN\Administrator Group (Incase its rights are not revoked)</li>
<li>Final Option is to change the registry value</li>
<li>You can change authentication mode via registry</li>
</ul>
<p><strong>What is the difference between sysadmin and serveradmin server role?</strong></p>
<blockquote><p><strong>sysadmin:</strong> Members of the sysadmin fixed server role can perform any activity in the server.</p>
<p><strong>serveradmin:</strong> Members of the serveradmin fixed server role can change server-wide configuration options and shut down the server.</p></blockquote>
<p><strong>How to check SA login related information?</strong><br />
<pre class="crayon-plain-tag">USE Master
GO
SELECT sid, [name], createdate, updatedate
FROM master.dbo.syslogins
WHERE [name] = 'sa'
GO</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-3)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 20 Jul 2016 04:24:20 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[authentication mode]]></category>
		<category><![CDATA[Change Data Capture CDC]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[password policy]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SA Account]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[trustworthy]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3372</guid>

					<description><![CDATA[What do you know about the Change Data Capture (CDC)? Change Data Capture (CDC) is used to track the changed data caused by common DML operations (INSERT/UPDATE/DEKLETE). The capture process reads the transaction log to pull out the data change information and then load the information into the associated change table. How to disable change [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-3)"></a></p><p><strong>What do you know about the Change Data Capture (CDC)?</strong></p>
<blockquote><p>Change Data Capture (CDC) is used to track the changed data caused by common DML operations (INSERT/UPDATE/DEKLETE). The capture process reads the transaction log to pull out the data change information and then load the information into the associated change table.</p></blockquote>
<p><strong>How to disable change data capture (CDC) on a table?</strong></p><pre class="crayon-plain-tag">USE Your_Database_Name
GO
EXEC sys.sp_cdc_disable_table
@source_schema = N'dbo',
@source_name = N'YourTableName',
@capture_instance = N'dbo_YourTableName'
GO</pre><p>
<strong>How to check if Change Data Capture is enabled or disabled on a SQL Server Database?</strong></p><pre class="crayon-plain-tag">SELECT [name], is_cdc_enabled
FROM sys.databases where name = 'Database_Name'
/*
is_cdc_enabled = 0 -- CDC is disabled
is_cdc_enabled = 1 -- CDC is enabled
*/</pre><p>
<strong>How to Restore Database On Which Change Data Capture (CDC) Is Enabled?</strong></p>
<blockquote><p>When we restore a database from a CDC enabled database backup, it does not restore the CDC object automatically. Also if you try to look for some options for Restore with CDC object etc. in Database Restore Wizard, you would not find anything.</p>
<p>If we restore the database on the same SQL Server instance with same name, CDC objects will be restored and it will start working fine as CDC jobs are available on the server already.</p>
<p>If you try to restore with a different name or restore to different SQL Server instance, It will not restore CDC objects by default. In Restore Database statement, we have to include Keep_CDC.</p></blockquote>
<p><strong>What is the Guest user account in SQL Server?  What login is it mapped to it?</strong></p>
<blockquote><p>The Guest user account is created by default in all databases and is used when explicit permissions are not granted to access an object.  It is not mapped directly to any login, but can be used by any login.</p></blockquote>
<p><strong>How can SQL Server instances be hidden?</strong></p>
<blockquote><p>To hide a SQL Server instance, we need to make a change in SQL Server Configuration Manager. To do this launch SQL Server Configuration Manager and do the following: select the instance of SQL Server, right click and select Properties.</p>
<p>After selecting properties you will just set Hide Instance to &#8220;Yes&#8221; and click OK or Apply. After the change is made, you need to restart the instance of SQL Server to not expose the name of the instance.</p></blockquote>
<p><strong>Is it possible to disable SA, how?</strong></p>
<blockquote><p>Disable the SA Login</p>
<p>Disabling the SA account is a good option to prevent its use. When it is disabled no one can use it in any circumstance until it is enabled.</p></blockquote>
<p><strong>What is the difference between Authenticate and Authorization?</strong></p>
<blockquote><p>When you log on to a PC with a user name and password you are authenticating. Authorization is the process of verifying that you have access to something. Gaining access to a resource (e.g. directory on a hard disk) because the permissions configured on it allow you access is authorization.</p></blockquote>
<p><strong>Which one is highest privileged role out of SQLAgentUserRole, SQLAgentReaderRole, SQLAgentOperatorRole?</strong></p>
<blockquote><p>SQLAgentOperatorRole is the most privileged of the SQL Server Agent fixed database roles. It includes all the permissions of SQLAgentUserRole andSQLAgentReaderRole. Members of this role can also view properties for operators and proxies, and enumerate available proxies and alerts on the server.</p></blockquote>
<p><strong>What is the password policy for SQL Server Accounts?</strong></p>
<ul>
<li>The password must contain uppercase &amp; lowercase letters.</li>
<li>The password must contain numbers &amp; alphanumeric characters.</li>
<li>The password must contain non-alphanumeric characters such as &amp;, ^,%,*,$ etc.</li>
<li>Do not use common known passwords that are easy to guess such as: admin, password, sa, administrator, sysadmin etc.</li>
<li>Passwords should be long enough (at least 8 characters long).</li>
<li>It does not allows blank password for the SA account.</li>
</ul>
<p><strong>What are the disadvantages of SQL Server Authentication Mode?</strong></p>
<blockquote><p>If a user is a Windows domain user who has a login and password for Windows, he must still provide another (SQL Server) login and password to connect. Keeping track of multiple names and passwords is difficult for many users. Having to provide SQL Server credentials every time that one connects to the database can be annoying.</p>
<p>SQL Server Authentication cannot use Kerberos security protocol.</p>
<p>Windows offers additional password policies that are not available for SQL Server logins.</p>
<p>The encrypted SQL Server Authentication login password, must be passed over the network at the time of the connection. Some applications that connect automatically will store the password at the client. These are additional attack points.</p></blockquote>
<p><strong>When CHECK_POLICY is ON, what kind of behavior occur?</strong></p>
<blockquote><p>CHECK_EXPIRATION is also set to ON unless it is explicitly set to OFF.</p>
<p>The password history is initialized with the value of the current password hash.</p>
<p>Account lockout duration, account lockout threshold, and reset account lockout counter after are also enabled.</p></blockquote>
<p><strong>What is What is TRUSTWORTHY database?</strong></p>
<blockquote><p>Applies To: SQL Server 2016.</p>
<p>The TRUSTWORTHY database property is used to indicate whether the instance of SQL Server trusts the database and the contents within it. By default, this setting is OFF, but can be set to ON by using the ALTER DATABASE statement.</p>
<p>This property can be used to reduce certain threats that can exist as a result of attaching a database.</p></blockquote>
<p><strong>Where are the places that I should not use the sa login?</strong></p>
<ul>
<li>Embedded in management tools or application development tools</li>
<li>Hard coded in application connection strings</li>
<li>DTS or SSIS connection objects</li>
<li>UDL files</li>
<li>Batch files</li>
<li>SQLCMD, OSQL or ISQL T-SQL scripts</li>
<li>In casual conversation</li>
<li>On sticky notes on your desk or monitor</li>
</ul>
<p><strong>What is the use of BUILTIN\Administrators Group in SQL Server?</strong></p>
<blockquote><p>Any Windows login in BUILTIN\Administrators group is by default a SQL Server system administrator. This single group can be used to manage administrators from a Windows and SQL Server perspective.</p></blockquote>
<p><strong>How to detect Orphaned Users in SQL Server?</strong><br />
<pre class="crayon-plain-tag">SELECT dp.type_desc, dp.SID, dp.name AS user_name
FROM sys.database_principals AS dp
LEFT JOIN sys.server_principals AS sp
ON dp.SID = sp.SID
WHERE sp.SID IS NULL
AND authentication_type_desc = 'INSTANCE';</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
