Teratdata数据库中,一个用可以对应多个账户,账户包含优先级信息,在登陆的时候,如果加上账户信息,就可以控制用户优先级。本篇对此进行介绍。
[@more@]创建并使用 Account IDs
登陆语法:
.LOGON tdpid/user_name, password, 'account_ID';
交互式登陆语法:
.LOGON tdpid/user_name,, 'account_ID' (note the two commas)
Enter password when prompted
CREATE USER tfact07 # Names user
FROM Sysdba # Name of immediate owner in hierarchy
AS PERM = 10e6 # Amount of Permanent space
,SPOOL = 100e6 # Maximum amount of Spool space
,PASSWORD = secure12 # Initial password
,FALLBACK # Default protection type when creating a table
,ACCOUNT = ( '$M', # Default account code – medium priority
'$M_9038', # Optional account code – medium priority
'$M_9038_&S&D&H', # Optional account code – medium priority with ASE
'$H_9038' ); # Optional account code – high priority
则登陆时,就可以带上ACCOUNT信息,以表明用户优先级,Example:
直接登入: .LOGON educ/tfact07,secure12,'$H'
交互式登陆:.LOGON educ/tfact07,,'$H'
动态修改 Account ID
• You can change your Account ID without logging off.
-- 可用来重设查询优先顺序.
-- 也可用来优化查询(nice a query).
• You can change Account IDs for the next SQL statement you run, or for all jobs for the remainder of the current session.
• To change Account IDs, use the SET SESSION ACCOUNT statement:
• Syntax:
-- For the next SQL statement : SET SESSION ACCOUNT = 'Account_ID' FOR REQUEST;
-- For the rest of the current session: SET SESSION ACCOUNT = 'Account_ID' FOR SESSION;
• Example:
-- For the rest of the tfact07 session: SET SESSION ACCOUNT = '$H_9038' FOR SESSION;
• Note: You can only use valid account IDs.
-- Therefore, you cannot exceed the priority defined by the performance groups in your account ID.
账户优先级:
用户优先级可有$L, $M, $H, $R几种:
修改用户优先级: modify user username as account = '$H_***'; (也可直接用pmon来修改)
查看修改结果:select * from DBC.AccountInfo
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16723161/viewspace-1013673/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16723161/viewspace-1013673/