Redian新闻
>
sql server 面试题 (7)
avatar
sql server 面试题 (7)# Database - 数据库
z*y
1
问题来了!
这个是考察DBA的基本管理技能,主要看DBA是不是头脑清楚。 大概是去年的电面。
sql server 2005 only
1. As DBA, you need to drop one login from your db instance. Not only drop
the login, you also need to drop associated user with this login from all
databases.
Currently this user might be active in several databases.
what would you do?
Use script to give a solution.
2是关于security controls。
2. Project architect need to view the definitions of two stored procedures
on production server. Currently this user only has db_datareader
avatar
c*d
2
1. logins and users
the following sql gives you a little hint
select
'select master..syslogins.name as login_name,'
+ name +
'..sysusers.name as user_name
from master..syslogins inner join sysusers
on master..syslogins.sid = sysusers.sid'
from
master..sysdatabases

【在 z***y 的大作中提到】
: 问题来了!
: 这个是考察DBA的基本管理技能,主要看DBA是不是头脑清楚。 大概是去年的电面。
: sql server 2005 only
: 1. As DBA, you need to drop one login from your db instance. Not only drop
: the login, you also need to drop associated user with this login from all
: databases.
: Currently this user might be active in several databases.
: what would you do?
: Use script to give a solution.
: 2是关于security controls。

avatar
p*l
3
1. sp_helplogins, sp_dropalias, sp_droplogin, sp_dropuser
2. Actually they already can view the source as datareader.

【在 z***y 的大作中提到】
: 问题来了!
: 这个是考察DBA的基本管理技能,主要看DBA是不是头脑清楚。 大概是去年的电面。
: sql server 2005 only
: 1. As DBA, you need to drop one login from your db instance. Not only drop
: the login, you also need to drop associated user with this login from all
: databases.
: Currently this user might be active in several databases.
: what would you do?
: Use script to give a solution.
: 2是关于security controls。

avatar
z*y
4
1. Not complete...let's use new feature of SQL Server 2005 instead. Also,
can you drop user when the user has active connection? If you can, why? If
you cannot, how to proceed?
2. Are you sure?

【在 p********l 的大作中提到】
: 1. sp_helplogins, sp_dropalias, sp_droplogin, sp_dropuser
: 2. Actually they already can view the source as datareader.

avatar
B*g
5
1最后两句说反了

【在 z***y 的大作中提到】
: 1. Not complete...let's use new feature of SQL Server 2005 instead. Also,
: can you drop user when the user has active connection? If you can, why? If
: you cannot, how to proceed?
: 2. Are you sure?

avatar
S*k
6
1.
Get mapped users of a login
sp_helplogins
Get principal_id of a database user
select * from sys.database_principals
Get schema owned by the database user
select * from sys.schemas
change schema ownership if necessary
ALTER authorization on schema::schema_name to other_principal_name
Drop database user
Drop user user_name
Get session id of connections
select * from sys.dm_exec_sessions where login_name = 'login_name'
Kill session_id
DROP Login login_name
2.
Grant VIEW Definition ON OBJECT::Pro
avatar
z*y
7
多谢回复!窃以为这是最好的回答。

【在 S***k 的大作中提到】
: 1.
: Get mapped users of a login
: sp_helplogins
: Get principal_id of a database user
: select * from sys.database_principals
: Get schema owned by the database user
: select * from sys.schemas
: change schema ownership if necessary
: ALTER authorization on schema::schema_name to other_principal_name
: Drop database user

avatar
p*l
8
Oops, I forgot this is for SQL 2005. There are a lot of differece between 2k
and 2k5.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。