Oracle adds and empowers users changes passwords unlocks and deletes users

  • 2020-10-31 22:01:41
  • OfStack

Add user (as the user is created, schema with the same name is generated automatically)
CREATE USER "TESTER" PROFILE "DEFAULT" IDENTIFIED BY "TESTER" DEFAULT TABLESPACE "TESTDATA" TEMPORARY TABLESPACE "TESTTEMP" ACCOUNT UNLOCK;
Empowerment (to be honest, these permissions are used in development, if the user is in production, please create the corresponding system permissions for the user)
It is said that in the production environment, only connect resource is enough.
GRANT "CONNECT" TO "TESTER";
GRANT "RESOURCE" TO "TESTER";
GRANT "DBA" TO "TESTER";
GRANT "EXP_FULL_DATABASE" TO "TESTER";
GRANT "IMP_FULL_DATABASE" TO "TESTER";
Delete users: For example, if you created a user A, you can do this to delete it
connect sys/ password as sysdba;
drop user A cascade; // The user is deleted
The user changes the password to unlock it
ALTER USER "SCOTT" IDENTIFIED BY "*******"
ALTER USER "SCOTT" ACCOUNT UNLOCK
1. View all users:
select * from dba_user;
select * from all_users;
select * from user_users;
2. Check the user's system permissions:
select * from dba_sys_privs;
select * from all_sys_privs;
select * from user_sys_privs;
3. View user object permissions:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
4. View all roles:
select * from dba_roles;
5. View the roles that the user has:
select * from dba_role_privs;
select * from user_role_privs;
Create a new user name in Oracle
Connect to ORACLE database:
1. Set up its own database in Oracle Database Assistant;
2. Establish a connection with your own database in Oracle Net8 Easy config. Select one service name, IP: local IP 127.0.0.1, and database sid for you to establish
Database SID, user name: system, password: manager or their own password;
3. Connect to your own database in SQLPLUS, with user name: system, password: manager, or your own password: tom: the name you just created.
4. Display the current connected user :show user;
5. New user and authorization: sql > create user tom identified by password;
sql > grant connect,resource to tom; / / authorization
Note: Other authorizations include: create any procedure,select any dictionary(login oem is required),select any table, etc.
6. Use the newly established user: tom/ password to connect in sqlplus;
7. Create table Spaces.
The initialization parameter file for the database :init+ instance name.ora file. Edit the contents of this file to change the methods used by the database and the resources allocated.
Start the ORACLE database, run svrmgr30 in DOS mode, then enter connect internal, password :oracle, then enter startup.
Table space creation :storage manager
The rollback segment can be created in storage manager
Start the oracle database
Under the DOS window, enter svrmgr30 to start the server manager, enter connect internal, enter password oracle, enter shutdown, close the database, enter startup to start the database.
1. Initial password of Oracle after installation? 10g after the installation of the time to choose the advanced password can be set themselves, ha ha, scott/tiger is the same.
internal/oracle
sys/change_on_install
system/manager
scott/tiger
sysman/oem_temp
Create table space
create tablespace test1 datafile 'd:tabletest1.dbf' size 1M;
Create a user named wjq with a default table space of test1. In SQL*PLUS connect to the database as SYS user, run the following script.
create user wjq identified by password default tablespace test1;
Connect to sqlplus as user wjq
Table :CREATE TABLE t1(empno NUMBER(5) PRIMARY KEY, ename VARCHAR2(15) NOT NULL, job VARCHAR2(10), mgr NUMBER(5),hiredate
DATE DEFAULT (sysdate), sal NUMBER(7,2), comm NUMBER(7,2));
Create table T2 and specify the table space as test1:CREATE TABLE t2(empno NUMBER(5) PRIMARY KEY,ename VARCHAR2(15) NOT NULL, empno NUMBER NUMBER(5) PRIMARY VARCHAR2(15) NOT NULL,
job VARCHAR2(10),mgr NUMBER(5),hiredate DATE DEFAULT (sysdate),sal NUMBER(7,2),comm NUMBER(7,2)) TABLESPACE test1;
Insert record :insert into t1 values(101,'wang','it',25,',20,20);

Related articles: