How to authorize all user tables in Sybase database to specified users

How to authorize all user tables in Sybase database to specified users

Application scenario: After the sybase database is backed up from the server and restored to the local development computer, it is found that the login account sa has the object permissions of all tables in the database, but does not have the permissions to query, modify, and delete user tables, so it needs to be re-authorized.

Example description: Set the default database login account sa password to 123456, the operating database name is JScms, the user name in JScms corresponding to the login account sa is dbo, the user group is public, and the role is sa_role. So the batch authorization script can be given to Users, groups, roles. In this example, the authorization is given to the public group.

Steps:

1. Start - Run - Open the DOS interface


2. Log in to the SYBASE database and switch to the specified database:

C:\Users\Administrator>isql -Usa -P123456

1> use JScms

2> go


3. Generate a batch authorization script

1> select 'grant select,insert,delete,update on ' + name +' to public' from sysobjects where type ='U' order by name

2> go


4. Batch authorization script processing


Repeat twice using the right mouse button to click the Select All menu, then use Ctrl+V to copy the text in the DOS window to Notepad


Process the script in Notepad and add a line of go between each authorization statement


5. Copy the processed script to the DOS window and execute it


6. Inspection and authorization results



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324638180&siteId=291194637