Create the User Scott Manually

本文详细介绍了如何通过脚本创建Oracle数据库用户及其对象,并解决在配置产品用户配置文件时遇到的问题。通过使用$ORACLE_HOME/rdbms/admin/utlsampl.sql脚本创建用户scott及其实例,当出现错误提示时,需运行$ORACLE_HOME/sqlplus/admin/pupbld.sql脚本更新产品用户配置表。通过此表可以限制普通用户的某些操作,例如通过插入特定数据到PRODUCT_USER_PROFILE表来阻止用户执行DROP操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

When you build an database via "create database" statement, there always are not create the user scott and its objects. But we can create the user manually. There is a script $ORACLE_HOME/rdbms/admin/utlsampl.sql. You can just run this script to create the user scott and its objects.

SQL> @?/rdbms/admin/utlsampl.sql 

Always there will be an warning show like:

Error accessing PRODUCT_USER_PROFILE
Warning:  Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM

The root cause for this warning is there is no the table system.product_user_profile. Now, let's resole this problem.

connect as system.

SQL> conn system/passwd

Then, run a script $ORACLE_HOME/sqlplus/admin/pupbld.sql

SQL> @?/sqlplus/admin/pupbld.sql
SQL> desc product_user_profile
 Name                       Null?    Type
 ------------------------- -------- ----------------------------
 PRODUCT                   NOT NULL VARCHAR2(30)
 USERID                             VARCHAR2(30)
 ATTRIBUTE                          VARCHAR2(240)
 SCOPE                              VARCHAR2(240)
 NUMERIC_VALUE                      NUMBER(15,2)
 CHAR_VALUE                         VARCHAR2(240)
 DATE_VALUE                         DATE
 LONG_VALUE                         LONG

Now, all things are done.

Actually, the table product_user_profile is a mean to control users' privilege, with this table, sysdba can limit some action from general user. Here is an example.

SQL> insert into product_user_profile (
 2  product, userid, attribute, char_value)
 3  values (
 4  'SQL*Plus','SCOT%','DROP','DISABLED');
  1 row inserted
SQL> commit;
SQL> create table t_test_profile(
 2 id number);
   Table created.
SQL> drop table t_test_profle;
  SP2-0544: invalid command: drop

From this example, we can learn the effect of product_user_profile. Now oracle system reject all the "drop" action from users like 'SCOT%'.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值