使用nib修改Oracle数据库名称,有两个方法:一是将controlfile 转出来,修改数据库名称重建;另一个是使用nib 工具修改。我这里介
有两个方法:一是将controlfile 转出来,修改数据库名称重建;另一个是使用nib 工具修改。我这里介绍nib 工具修改操作方法。
工具nib 是Oracle 9i 开始提供的,专门用于修改数据库名称。
第一步,备份整库。
因为这种操作会有可能失败,所以必须要先备份。
第二步,将库正常关闭,再启动到mount 状态。
第三步,使用nib 修改数据库名称
修改命令为 nid target=sys/welcome1 dbname=webdb
修改完成后,,提示数据库已经关闭,需要使用open resetlogs 方式打开。
第四步,打开数据库。
打开之前,需要新生成符合新数据库名称的初始化参数文件和密码文件。监听器文件也需要做针对性修改。
/u04/webdb_rman@db3=>webreader$nid target=sys/welcome1 dbname=webdb
DBNEWID: Release 10.2.0.4.0 - Production on Tue May 15 11:43:33 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to database WEBREADER (DBID=4271057885)
Connected to server version 10.2.0
Control Files in database:
+VG1/webdb/control01.ctl
+VG1/webdb/control02.ctl
+VG1/webdb/control03.ctl
Change database ID and database name WEBREADER to WEBDB? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 4271057885 to 2506031974
Changing database name from WEBREADER to WEBDB
Control File +VG1/webdb/control01.ctl - modified
Control File +VG1/webdb/control02.ctl - modified
Control File +VG1/webdb/control03.ctl - modified
Datafile +VG1/webdb/system01.dbf - dbid changed, wrote new name
Datafile +VG2/webdb/data_salebill05.dbf - dbid changed, wrote new name
Datafile +VG1/webdb/sysaux01.dbf - dbid changed, wrote new name
Datafile +VG1/webdb/users01.dbf - dbid changed, wrote new name
Datafile +VG1/webdb/undotbs02.dbf - dbid changed, wrote new name
………………………
Instance shut down
Database name changed to WEBDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database WEBDB changed to 2506031974.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
/u04/webdb_rman@db3=>webreader$sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue May 15 11:42:04 2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 5.1540E+10 bytes
Fixed Size 2179936 bytes
Variable Size 6425676960 bytes
Database Buffers 4.5097E+10 bytes
Redo Buffers 14594048 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
/u04/webdb_rman@db3=>webreader$export ORACLE_SID=webdb
/u04/webdb_rman@db3=>webdb$sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue May 15 11:44:47 2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 5.1540E+10 bytes
Fixed Size 2179936 bytes
Variable Size 6425676960 bytes
Database Buffers 4.5097E+10 bytes
Redo Buffers 14594048 bytes
Database mounted.
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string webdb
SQL> alter database open resetlogs;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +VG2
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL>
更多Oracle相关信息见Oracle 专题页面 ?tid=12

MySQL是一種開源的關係型數據庫管理系統,主要用於快速、可靠地存儲和檢索數據。其工作原理包括客戶端請求、查詢解析、執行查詢和返回結果。使用示例包括創建表、插入和查詢數據,以及高級功能如JOIN操作。常見錯誤涉及SQL語法、數據類型和權限問題,優化建議包括使用索引、優化查詢和分錶分區。

MySQL是一個開源的關係型數據庫管理系統,適用於數據存儲、管理、查詢和安全。 1.它支持多種操作系統,廣泛應用於Web應用等領域。 2.通過客戶端-服務器架構和不同存儲引擎,MySQL高效處理數據。 3.基本用法包括創建數據庫和表,插入、查詢和更新數據。 4.高級用法涉及復雜查詢和存儲過程。 5.常見錯誤可通過EXPLAIN語句調試。 6.性能優化包括合理使用索引和優化查詢語句。

選擇MySQL的原因是其性能、可靠性、易用性和社區支持。 1.MySQL提供高效的數據存儲和檢索功能,支持多種數據類型和高級查詢操作。 2.採用客戶端-服務器架構和多種存儲引擎,支持事務和查詢優化。 3.易於使用,支持多種操作系統和編程語言。 4.擁有強大的社區支持,提供豐富的資源和解決方案。

InnoDB的鎖機制包括共享鎖、排他鎖、意向鎖、記錄鎖、間隙鎖和下一個鍵鎖。 1.共享鎖允許事務讀取數據而不阻止其他事務讀取。 2.排他鎖阻止其他事務讀取和修改數據。 3.意向鎖優化鎖效率。 4.記錄鎖鎖定索引記錄。 5.間隙鎖鎖定索引記錄間隙。 6.下一個鍵鎖是記錄鎖和間隙鎖的組合,確保數據一致性。

MySQL查询性能不佳的原因主要包括没有使用索引、查询优化器选择错误的执行计划、表设计不合理、数据量过大和锁竞争。1.没有索引导致查询缓慢,添加索引后可显著提升性能。2.使用EXPLAIN命令可以分析查询计划,找出优化器错误。3.重构表结构和优化JOIN条件可改善表设计问题。4.数据量大时,采用分区和分表策略。5.高并发环境下,优化事务和锁策略可减少锁竞争。

在數據庫優化中,應根據查詢需求選擇索引策略:1.當查詢涉及多個列且條件順序固定時,使用複合索引;2.當查詢涉及多個列但條件順序不固定時,使用多個單列索引。複合索引適用於優化多列查詢,單列索引則適合單列查詢。

要優化MySQL慢查詢,需使用slowquerylog和performance_schema:1.啟用slowquerylog並設置閾值,記錄慢查詢;2.利用performance_schema分析查詢執行細節,找出性能瓶頸並優化。

MySQL和SQL是開發者必備技能。 1.MySQL是開源的關係型數據庫管理系統,SQL是用於管理和操作數據庫的標準語言。 2.MySQL通過高效的數據存儲和檢索功能支持多種存儲引擎,SQL通過簡單語句完成複雜數據操作。 3.使用示例包括基本查詢和高級查詢,如按條件過濾和排序。 4.常見錯誤包括語法錯誤和性能問題,可通過檢查SQL語句和使用EXPLAIN命令優化。 5.性能優化技巧包括使用索引、避免全表掃描、優化JOIN操作和提升代碼可讀性。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Dreamweaver Mac版
視覺化網頁開發工具

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具