使用者執行個體是一種功能,它讓非管理員能夠以自己的帳戶執行 SQL Server 的本機版本。有了使用者執行個體,非管理員就能擁有自己帳戶中執行之執行個體的資料庫擁有者權限。
使用者執行個體 (也稱為子系或用戶端執行個體) 是父執行個體 (以服務執行的主要執行個體,例如 SQLExpress) 代表使用者所產生的 SQL Server 執行個體。使用者執行個體是在該使用者的安全性內容下,以使用者處理序的形式執行。使用者執行個體與父執行個體隔離,也與電腦上執行的其他任何使用者執行個體隔離。使用者執行個體功能也稱為「以一般使用者身份執行」(RANU)。
為何需要使用者執行個體?
以下列出部分理由,說明利用使用者執行個體模式的好處:
- 使用者執行個體模式的主要目標是要隔離 SQL Server 的非管理員使用者,以便讓使用者能夠附加任意資料庫,又不會危害其他的使用者。您可藉由為每個使用者產生個別的 SQL Server 執行個體,來達成這個隔離的目標。
- 除了隔離以外,SQL Server Express 還有另外一個目標,就是要讓非管理員使用者能夠輕鬆使用。許多 Windows 使用者都擁有含管理權限的帳戶。可惜的是,以管理員身份執行很容易讓惡意軟體控制使用者的電腦。不過,由非管理員使用者執行的惡意軟體不能進行全系統的變更,因此只會造成有限的損毀。
.........
..........
http://msdn2.microsoft.com/zh-tw/library/ms143684.aspx原文解釋:
Standard Security:
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
(both connection strings produces the same result)
Trusted Connection:
"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(both connection strings produces the same result)
(use serverName\instanceName as Data Source to use an specifik SQLServer instance)
Connect via an IP address:
"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
Enabling MARS (multiple active result sets):
"Server=Aron1;Database=pubs;Trusted_Connection=True;MultipleActiveResultSets=true"
Note! Use ADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 nor ADO.NET 1.1
Attach a database file on connect to a local SQL Server Express instance:
"Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
- or -
"Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
(use |DataDirectory| when your database file resides in the data directory)
Why is the "Database" parameter needed? Answer: If the database was previously attached, SQL Server does not reattach it (it uses the attached database as the default for the connection).
Using "User Instance" on a local SQL Server Express instance:"Data Source=.\SQLExpress;integrated security=true;attachdbfilename=|DataDirectory|\mydb.mdf;user instance=true;" The "User Instance" functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the computer. To enable the functionality: sp_configure 'user instances enabled','1' (0 to disable)