Oracle创建用户与权限操作
1.创建用户create user SQLgt;create user arthur identified by m123 (m123是密码,必须是以字母开头) 一般的普通用户是无权
1.创建用户create user
SQL>create user arthur identified by m123
(m123是密码,必须是以字母开头)
一般的普通用户是无权限用create user的
可以切换用户然后创建
#用system来创建用户arthur
SQL>conn system/密码
SQL>create user arthur identified by m123
------------------------------------------------------------------------
2.注意上面创建了arthur,但是它只是个孤零零的用户,
没有任何权限,所以下面的
链接语句也不会执行成功
SQL>conn arthur/m123,//没有权限,运行不成功
3.为了获得权限,用grant,收回一个权限revoke
可以让system来赋给arthur 权限
#首先登陆system
SQL>conn system/密码
SQL>grant connect to arhtur 回车//system把connect权限给予arthur
授权成功
然后执行链接
SQL>conn arthur/m123
就成功了
--------------------------------------------------------------------------
4.让用户arthur有权限建表,如果不付权限的话,arthur用户是不可以创建表的
SQL>conn system/密码
SQL>grant resource to arthur
授权成功
SQL>conn arthur/m123
SQL>create table table_name
--------------------------------------------------------------------------
5.希望arthur用户可以查询scott用户的emp表
授权者是:scott(因为emp是里面scott的表),
SQL>conn scott/密码
SQL>grant select on emp to arthur
授权成功
下面如果arthur想查询scott表emp可以用下面的语句(emp是表)
先登录
SQL>conn arthur/m123
SQL>select * from emp;//此句错误
SQL>select * from scott.emp;
说明此时arthur对emp只有查询权限
--------------------------------------------------------------------------
6.如果arthur用户想更新scott的emp,可以用下面的授权
SQL>conn scott/密码
SQL>grant update on emp to arthur
授权成功
说明此时arthur对emp只有更改权限
--------------------------------------------------------------------------
7.如果arthur用户可以修改/删除/查询/添加scott的emp表可以用下面的语句
SQL>conn scott/密码
SQL>grant all on emp to arthur
授权成功
收回权限(scott收回arthur对emp表的查询权限)
SQL>conn scott/密码
SQL> revoke select on emp from arthur
--------------------------------------------------------------------------
8'权限的传递,scott给arthur赋权限的同时,也允许arthur继续把权限传递下去
当然arthur传递的权限不能超越scott所受的权限
scott>--arthur>----somebody
如果是对象权限,就加入 with grant option
SQL> conn scott/密码
已连接
SQL>grant select on emp to arthur with grant option
下面arthur把对emp的选择权限受权给另一个用户 tom
#先登录
SQL>conn arthur/m123
SQL>grant select on emp to tom //此种写法错误,arthur里面没有emp表
SQL>grant select on scott.emp to tom
注意:当scott把arthur的权限select回收revoke时,tom对emp的select权限也是被回收了
如果是系统权限
system 赋权给arthur

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

AI Hentai Generator
Generate AI Hentai for free.

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



Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.

Use the DataAccessObjects (DAO) library in C++ to connect and operate the database, including establishing database connections, executing SQL queries, inserting new records and updating existing records. The specific steps are: 1. Include necessary library statements; 2. Open the database file; 3. Create a Recordset object to execute SQL queries or manipulate data; 4. Traverse the results or update records according to specific needs.

How to integrate GoWebSocket with a database: Set up a database connection: Use the database/sql package to connect to the database. Store WebSocket messages to the database: Use the INSERT statement to insert the message into the database. Retrieve WebSocket messages from the database: Use the SELECT statement to retrieve messages from the database.

JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.
