Oracle Database SQL statements, database management, oraclesql
Conn system/12345678
-- Query the status of all users
Select username, account_status from dba_users;
-- Query data files
Select tablespace_name, file_name from dba_data_files;
-- Query all Permissions
Select * from system_privilege_map;
-- Create a user
Create user user1 identified by 123;
-- Grant the database creation permission to connect to the database
Grant connect to user1;
Grant resource to user1;
-- Grant Permissions
Grant create session, create table, create view to user1;
-- Grant the pass-through permission
Grant create session, create table, create view to user1 with admin option;
-- Revoke permissions
Revoke create table, create view from user1;
Conn user1/123
Create table aaa (id int );
-- Database connection permission
Grant create session to user1;
Grant unlimited tablespace to user1; // grant the table space permission to user1.
-- Create Table permission
Grant create table to user1;
-- Delete table Permissions
Grant drop any table to user1;
-- Insert Table permission
Grant insert any table to user1;
-- Modify Table Permissions
Grant update any table to user1;
Grant all to public; // This is important. grant all permissions to all users (public)
Grant select on tablename to user1; // grant the zhangsan user the permission to view the specified table.
Grant drop on tablename to user1; // grant the table deletion permission.
Grant insert on tablename to user1; // grant the insert permission
Grant update on tablename to user1; // grant the table modification permission.
Grant insert (id) on tablename to user1;
Grant update (id) on tablename to user1; // grant the insert and modify permissions to specific fields in the specified table. Note that only insert and update are allowed.
Grant alert all table to user1; // grant permissions to any table of the zhangsan user alert