About Scott

博客围绕Oracle 12c中Scott用户展开,介绍了默认用户被锁时解锁方法,操作出问题时重建方法,还提及查看用户权限、表,iSQLPlus端口获取,Scott的登陆方式。此外,指出用oracle sql developer连接数据库有问题,以及可导出EMP表信息。

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

1、在Oracle10g,11g,12c中,处于安全性考虑,包括scott在内的默认用户,都会被锁住,需要先以system or sys登陆sqlplus然后执行:alter user scott identified by tiger account unlock;
2、scott用户的某个队形如果在操作过程中出现问题,就找到Oracle安装目录*:\app\oracle12c\product\12.1.0\dbhome_1 \RDBMS\ADMIN里面的scott.sql,通过运行它来重建scott和它所拥有的一切。
用system登陆之后执行以下的脚本语句:	
@D:\app\oracle12c\product\12.1.0\dbhome_1\RDBMS\ADMIN\scott.sql
3、Scott的用户权限:select * from session_privs;
4、scott下面的表:select table_name from user_tables;
5、Oracle9i之后还提供了iSQLPlus即是网页版的SQLPLUS。登陆需要先获得iSQLPlus的端口号::\app\oracle12c\product\12.1.0\dbhome_1\install\portlist.ini在里面加上:
iSQL*Plus HTTP 端口号 =5560
Enterprise Manager Console HTTP 端口 (jinlian) = 1158
Enterprise Manger 代理端口 (jinlian) = 3938
还需要在环境变量里面添加上:
尴尬的是oracle11g之后就不再有isqlplus了。
6、scott的两种登陆方式:
  I、win+r->cmd->sqlplus scott/tiger
 II、wint+r->sqlplus->scott+tiger
7、问题是现在用oracle sql developer连接数据库出现了问题
问题一:用scott创建数据库连接会报invalid user/password 
问题二:用system创建本地库的连接之后alter user scott account unlock会报错:user scott不存在
Solution:修改“连接类型”为“本地/继承”—然后用scott连接就没有问题

在这里插入图片描述
登陆进去也能看见scott自带的那几张表:DEPT、EMP、SALGRADE、BONUS

8、可以使用SQL developer导出EMP表的任何信息:

在这里插入图片描述
在这里插入图片描述

以下是C++的实现代码: ```c++ #include <iostream> #include <string> using namespace std; class Book { private: string title; // 书名 string author; // 作者 int year; // 出版年份 bool inLibrary; // 是否在图书馆 public: void loadBook(string t, string a, int y, bool l) { title = t; author = a; year = y; inLibrary = l; } void displayBook() { cout << "Title: " << title << endl; cout << "Author: " << author << endl; cout << "Year of Publication: " << year << endl; if (inLibrary) cout << "Status: In Library" << endl; else cout << "Status: Taken Out" << endl; } bool checkLibrary() { return inLibrary; } }; int main() { Book books[3]; // 添加图书信息 books[0].loadBook("The Great Gatsby", "F. Scott Fitzgerald", 1925, true); books[1].loadBook("To Kill a Mockingbird", "Harper Lee", 1960, false); books[2].loadBook("1984", "George Orwell", 1949, true); // 显示图书信息 for (int i = 0; i < 3; i++) { cout << "Book " << i + 1 << endl; books[i].displayBook(); cout << endl; } // 检查图书馆中是否有特定书籍 if (books[0].checkLibrary()) cout << "The Great Gatsby is in the library." << endl; else cout << "The Great Gatsby has been taken out." << endl; return 0; } ``` 输出结果如下: ``` Book 1 Title: The Great Gatsby Author: F. Scott Fitzgerald Year of Publication: 1925 Status: In Library Book 2 Title: To Kill a Mockingbird Author: Harper Lee Year of Publication: 1960 Status: Taken Out Book 3 Title: 1984 Author: George Orwell Year of Publication: 1949 Status: In Library The Great Gatsby is in the library. ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值