Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.77 MB, 182 trang )
Part I: Database Administration
Can SQL Server Enterprise Edition be installed on client
operating systems?
Answer
In previous releases of SQL Server, such as SQL Server 2005 or earlier versions,
the setup would be blocked on client operating systems. It is no longer blocked
since the SQL Server 2008 release, but it is still not a support configuration.
I recommend that you install SQL Server Developer Edition which has identical
functionalities as Enterprise Edition on your client OS.
Reference
Hardware and Software Requirements for Installing SQL Server 2008:
http://msdn.microsoft.com/en-us/library/ms143506.aspx
Microsoft SQL Server TechNet Forum Support Team | Part I
Database Administration
20
Part I: Database Administration
How do I troubleshoot SQL Server connectivity issues?
Answer
You may encounter the problem that you cannot connect to your SQL Server
instance remotely. You can refer to the following common practices to
troubleshoot this issue:
1. Check your SQL Server Error log to make sure that it enables TCP/IP protocol
and establish the listening on a specific TCP port.
Normally, if SQL Server is configured to enable TCP/IP protocol, when it
starts it will log a message similar to the following error log:
2010-01-04 12:30:40.47 Server Server is listening on [ 'any'
This means that the SQL Server instance is using TCP/IP protocol and
listening on the TCP port 1433.
2. Enable TCP/IP protocol if you could not find the message in the Error Log.
You can enable protocols via SQL Server Configuration Manager. Under SQL
Server Network Configuration->Protocols for
TCP/IP protocol.
3. Check Network issue after TCP/IP enabled.
To check if your network is healthy, you can use ping and telnet orders to
check.
· Run "ping -t" for 1-2 minutes to check if there any timeout response
ping -t
If there are timeout responses, contact your network administrator to
check the network issue.
· Run "telnet" command directly to the TCP port on the server to check if
you can access the TCP port.
Telnet
4. Check firewall if you cannot telnet to the specific TCP port.
Ensure that the TCP port on which SQL Server is listening has been put into
the exceptions of your firewall. If you connect to a named instance, it is also
recommended that you put the UDP port 1434 for SQL Server Browser
service into your firewall exception.
The connection issues may be due to other causes like client drivers, application
configuration, authentication and ect.
Reference
Turn on Telnet Client feature on Windows Vista or later versions and other telnet
frequently asked questions:
http://windows.microsoft.com/en-us/windows-vista/Telnet-frequently-asked-qu
estions
Troubleshooting SQL connectivity issues from Microsoft Protocols Team blogs.
Microsoft SQL Server TechNet Forum Support Team | Part I
Database Administration
21
Part I: Database Administration
http://blogs.msdn.com/sql_protocols/archive/2008/04/30/steps-to-troubleshoo
t-connectivity-issues.aspx
Why can’t I track data changes even though I already
enabled the database audit on my database?
Answer
Database Audit does not track data changes. To track the data changes, you need
to use another feature named "Change Data Capture" (CDC).
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. You can refer to the following articles
to create the server and database level audit:
Creating and Managing Audits with SQL Server Management Studio
http://msdn.microsoft.com/en-us/library/cc280500.aspx
Creating and Managing Audits with Transact-SQL
http://msdn.microsoft.com/en-us/library/cc280665.aspx
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. It also checks the principles defined in the
database audit specification. If the operations are not executed by the defined
principles, it will not log the audits.
You can read the Windows event logs by using the Event Viewer utility in
Windows. For file targets, you can use either the Log File Viewer in SQL Server
Management Studio or the fn_get_audit_file function to read the target file.
Change Data Capture
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. You can use the function
fn_cdc_get_all_changes_
information.
Reference
Change Data Capture
http://msdn.microsoft.com/en-us/library/bb522489.aspx
Microsoft SQL Server TechNet Forum Support Team | Part I
Database Administration
22
Part I: Database Administration
How do I use Powershell script to read the information of
any database on a server?
Answer
To read the information of a database, you can first grant the VIEW ANY
DEFINITION permission to the current login.
VIEW ANY DEFINITION is at server scope. For example:
GRANT VIEW ANY DEFINITION TO test
Go
Then you can read a database information with the Powershell script like the
following:
$srvname="localhost"
$dbname="Test"
$mySrvConn = new-object
Microsoft.SqlServer.Management.Common.ServerConnection
$mySrvConn.ServerInstance=$srvname
$mySrvConn.LoginSecure = $false
$mySrvConn.Login = "test"
$mySrvConn.Password = "xxxxxx"
$srv = new-object
Microsoft.SqlServer.Management.SMO.Server($mySrvConn)
$db = $srv.Databases[$dbname]
$db.logfiles|measure-object -property size -sum
$logsize = ($db.logfiles|measure-object -property Size -sum).Sum/1024
$datasize = $db.Size - $logsize
write-host "log size:" $logsize
write-host "data size:" $datasize
$srv.ConnectionContext.Disconnect()
Reference
SQL Server Powershell Overview
http://msdn.microsoft.com/en-us/library/cc281954.aspx
Advanced Microsoft SQL Server Powershell Tips and Tricks
http://www.microsoft.com/emea/spotlight/sessionh.aspx?videoid=984
Microsoft SQL Server TechNet Forum Support Team | Part I
Database Administration
23