Oracle 添加用户并赋权,修改密码,解锁,删除用户的方法
Oracle 添加用户并赋权,修改密码,解锁,删除用户实现方法,需要的朋友可以参考下。
添加用户(随着用户的创建,自动产生与用户同名的schema)CREATE USER "TESTER" PROFILE "DEFAULT" IDENTIFIED BY "TESTER" DEFAULT TABLESPACE "TESTDATA" TEMPORARY TABLESPACE "TESTTEMP" ACCOUNT UNLOCK;
赋权(说实话,这些权限是开发中使用的权限,如果用户生产环境,请自行对于用户创建相应的系统权限)
据说生产环境下,只是connect resource这样的角色就可以了。
GRANT "CONNECT" TO "TESTER";
GRANT "RESOURCE" TO "TESTER";
GRANT "DBA" TO "TESTER";
GRANT "EXP_FULL_DATABASE" TO "TESTER";
GRANT "IMP_FULL_DATABASE" TO "TESTER";
删除用户:例如创建了一个用户 A,要删除它可以这样做
connect sys/密码 as sysdba;
drop user A cascade;//就这样用户就被删除了
用户修改密码,解锁
ALTER USER "SCOTT" IDENTIFIED BY "*******"
ALTER USER "SCOTT" ACCOUNT UNLOCK
1.查看所有用户:
select * from dba_user;
select * from all_users;
select * from user_users;
2.查看用户系统权限:
select * from dba_sys_privs;
select * from all_sys_privs;
select * from user_sys_privs;
3.查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
4.查看所有角色:
select * from dba_roles;
5.查看用户所拥有的角色:
select * from dba_role_privs;
select * from user_role_privs;
Oracle中新建用户名
连接ORACLE数据库:
1、在Oracle Database Assistant中建立自己的数据库;
2、在Oracle Net8 Easy config中建立连接与自己的数据库的连接,取一个service名,IP:为本地IP 127.0.0.1,database sid为你所建立的
数据库的SID,用户名为:system,密码:manager或是自己设的密码;
3、在SQLPLUS中连接自己的数据库,用户名为:system,密码:manager或是自己设的密码,tom:你刚建立的service名.
4、显示当前连接用户:show user;
5、新建用户并授权:sql>create user tom identified by 密码;
sql> grant connect,resource to tom;//授权
注:授权还有:create any procedure,select any dictionary(登陆oem需要),select any table等.
6、在sqlplus中用刚建立的用户:tom/密码,连接;
7、建立表空间。
数据库的初始化参数文件:init+实例名.ora文件,编辑此文件中的内容,可以改变数据库使用的方法和分配的资源.
启动ORACLE数据库,在DOS方式下运行svrmgr30,然后输入connect internal,密码为:oracle,再输入startup即可.
表空间的建立:storage manager
回滚段可在storage manager中建立
启动oracle数据库
在DOS窗口下,输入svrmgr30,启动服务器管理器,输入connect internal,输入密码oracle,输入shutdown,关闭数据库,输入startup,启动数据库.
1. Oracle安装完成后的初始口令?10g以后安装的时候选高级,密码都可以自己设置,呵呵,scott/tiger是不变的。
internal/oracle
sys/change_on_install
system/manager
scott/tiger
sysman/oem_temp
建立表空间
create tablespace test1 datafile 'd:tabletest1.dbf' size 1M;
创建名为wjq的用户,其缺省表空间为test1。在SQL*PLUS以SYS用户连接数据库,运行以下脚本。
create user wjq identified by password default tablespace test1;
以用户wjq连接sqlplus
建立表: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));
建立表T2并指定此表的表空间为test1:CREATE TABLE t2(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)) TABLESPACE test1;
插入记录:insert into t1 values(101,'wang','it',25,'',20,20);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



To query the Oracle tablespace size, follow the following steps: Determine the tablespace name by running the query: SELECT tablespace_name FROM dba_tablespaces; Query the tablespace size by running the query: SELECT sum(bytes) AS total_size, sum(bytes_free) AS available_space, sum(bytes) - sum(bytes_free) AS used_space FROM dba_data_files WHERE tablespace_

There are three ways to view instance names in Oracle: use the "sqlplus" and "select instance_name from v$instance;" commands on the command line. Use the "show instance_name;" command in SQL*Plus. Check environment variables (ORACLE_SID on Linux) through the operating system's Task Manager, Oracle Enterprise Manager, or through the operating system.

Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

Uninstall method for Oracle installation failure: Close Oracle service, delete Oracle program files and registry keys, uninstall Oracle environment variables, and restart the computer. If the uninstall fails, you can uninstall manually using the Oracle Universal Uninstall Tool.

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

Oracle Invalid numeric errors may be caused by data type mismatch, numeric overflow, data conversion errors, or data corruption. Troubleshooting steps include checking data types, detecting digital overflows, checking data conversions, checking data corruption, and exploring other possible solutions such as configuring the NLS_NUMERIC_CHARACTERS parameter and enabling data verification logging.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.
