Hello everyone welcome to one of another ENTOPDBA tutorial.
in this tutorial we are going to learn bellow concepts: a. Alter tablespace datafile using file_id and file_name and resize datafile. b. How to check Tablespace Size. c. How to check datafile Size in MB. d. How to drop Tablespace including contents and all Datafiles of these tablespace.Friday, December 22, 2023
How to Create, Alter, Resize, Drop Tablespace | Tablespace Management part# 1
How to change oracle database instance name using NID utility
Hello everyone, in this article we are going to learn how to rename a database instance name using the NID utility step by step. So in this demo, we are going to rename the OEM database name to OEMNEW.
for your Info Before the NID utility, we can rename the database instance name using creating a new control file that was the manual method, but after the NID utility, our task is now easy to change the database instance name.Please do follow me and support me on, Subscribe for more videos just like this: https://www.youtube.com/@entopdba501?... YouTube: https://www.youtube.com/@entopdba501?... Website: https://afgdba.blogspot.com/ Regards, ENTOPDBA
Sunday, October 22, 2023
How to Use DATA PUMP to migrate to OCI autonomous database | oracle DBA Tutorial
In this Oracle Tutorial you will learn how to Use DATA PUMP to migrate to OCI autonomous database using Parameter File (PARFILE) in Data Pump expdp export utility.
Please do follow me and support me on,
Subscribe for more videos just like this: https://www.youtube.com/@entopdba501?sub_confirmation=1
YouTube: https://www.youtube.com/@entopdba501?sub_confirmation=1
Facebook: https://www.facebook.com/afgblog
Website: https://afgdba.blogspot.com/
Regards,
ENTOPDBA
email: entopdba@gmail.com
Monday, August 7, 2023
Useful Oracle 19c RAC Commands
Oracle oracle 19c rac commands, oracle 19c rac crsctl commands, oracle 19c rac srvctl commands, oracle 19c rac start sequence, oracle 19c rac stop sequence, oracle 19c rac stop/start one node
WHAT IS THE DIFFERENCE BETWEEN SRVCTL AND CRSCTL?
SERVER CONTROL UTILITY (SRVCTL)
Server Control Utility (SRVCTL): It is used to administer Oracle Real Application
Clusters (Oracle RAC) databases and instances.
Use SRVCTL to manage Oracle supplied resources such as:
- Database
- Listener
- Instances
- Disk groups
- Networks
If resource name begins with ora then use SRVCTL. Oracle
suggest DBAs to use srvctl command to stop/start the databases.
We can use the SRVCTL to manage configuration
information. Use SRVCTL commands to add, remove, start, stop, modify,
enable, and disable a number of entities, such as Databases, instances,
listeners, SCAN listeners, services, grid naming Service (GNS), and Oracle ASM.
CLUSTERWARE CONTROL UTILITY (CRSCTL)
Clusterware Control Utility (CRSCTL): It is used to managed oracle clusterware resources
and components.
Use CRSCTL for managing Oracle Clusterware and its
resources. CRSCTL command is used to manage the elements of the clusterware
like crs, css, evm.
CRSCTL manages Oracle Clusterware related operations like:
- Starting and stopping Oracle
Clusterware
- Enabling and disabling Oracle
Clusterware daemons
- Checking the health of the
cluster
- Registering cluster resources
SERVER CONTROL UTILITY (SRVCTL) – DATABASE RELATED COMMANDS
srvctl -help >>> List All Commands With Syntax
srvctl status listener -n node1 >>> Check Listener
Status Of Specific Node
srvctl status listener >>> Check Listener Status Of All Nodes
srvctl start listener -n node1 >>> Start Listener
On Specific Node
srvctl start listener >>> Start Listener On All Nodes
srvctl stop listener -n node1 >>> Stop Listener On
Specific Node
srvctl stop listener >>> Stop Listener On All Nodes
srvctl status instance -d TEST -i TEST1 >>> Check
Status Of Specific Instance
srvctl status database -d TEST >>> Check Status Of All Instances
srvctl start instance -d TEST -i TEST1 >>> Starts
Specific Instance
srvctl start database -d TEST >>> Starts All Instances (+Open
Database)
srvctl start database -d TEST -o nomount >>>
Starts Service As Nomount
srvctl start database -d TEST -o mount >>> Starts Service As Mount
srvctl start database -d TEST -o open >>> Starts Service As Open
srvctl stop instance -d TEST -i TEST1 >>> Stops
Specific Instance
srvctl stop database -d TEST >>> Stops All Instances (+Shutdown
Database)
srvctl stop database -d TEST -o normal >>> Stops
Service As Normal
srvctl stop database -d TEST -o immediate >>> Stops Service As
Immediate
srvctl stop database -d TEST -o transactional >>> Stops Service As
Transactional
srvctl stop database -d TEST -o abort >>> Stops Service As Abort
srvctl config database >>> Check Registered
Databases In The Repository
srvctl config database -d TEST >>> Check Specific Database
Configuration
CLUSTERWARE CONTROL UTILITY (CRSCTL) – CLUSTER RELATED COMMANDS
crsctl config has >>> Check Oracle HAS (High
Availabilty Services) Config
crsctl disable has >>> Disable Automatic Startup Of The Oracle High
Availability Services
crsctl enable has >>> Enable Automatic Startup Of The Oracle High
Availability Services
crsctl check crs >>> Check Oracle High
Availability Services On The Local Server.
crsctl stop crs >>> Stop Oracle High Availability Services On The
Local Server.
crsctl start crs >>> Start Oracle High Availability Services On The
Local Server.
crsctl query crs softwareversion >>> Check Oracle
Clusterware Software Version
crsctl query crs activeversion >>> Check Oracle Clusterware Acitve
Version
crsctl query crs releaseversion >>> Check Oracle Clusterware Release
Version
OTHER USEFUL COMMANDS
show parameter CLUSTER_DATABASE; >>> Check
Database Running As Cluster Or Not.
select instance_name, host_name, archiver, thread#, status
from gv$instance; >>> Check RAC Status.
SHUTDOWN SEQUENCE OF ONLY ONE NODE IN A CLUSTER
Check Database And ASM Instance
[root@node1 ~]# ps -ef | grep pmon |
grep -v grep
grid 9901 1 0 Sept10 ? 00:00:04 asm_pmon_+ASM1
oracle 16761 1 0 03:00 ? 00:00:00 ora_pmon_TEST1
[root@node1 ~]#
Check And Stop Instance
[root@node1 ~]# srvctl status instance
-d TEST -i TEST1
[root@node1 ~]# srvctl stop instance -d TEST -i TEST1
[root@node1 ~]# srvctl status instance -d TEST -i TEST1
Check And Stop Oracle High Availability Services On The
Local Server
[root@node1 ~]# crsctl check crs
[root@node1 ~]# crsctl stop crs
[root@node1 ~]# crsctl check crs
Check Database And ASM Instance
[root@node1 ~]# ps -ef | grep pmon |
grep -v grep
[root@node1 ~]#
STARTUP SEQUENCE OF ONLY ONE NODE IN A CLUSTER
Check And Scan ASM Discs
[root@node1 ~]# ll
/dev/oracleasm/disks/
[root@node1 ~]# oracleasm scandisks
[root@node1 ~]# ll /dev/oracleasm/disks/
Check And Start Oracle High Availability Services On The
Local Server
[root@node1 ~]# crsctl check crs
[root@node1 ~]# crsctl start crs
[root@node1 ~]# crsctl check crs
Check And Start Instance
[root@node1 ~]# srvctl status instance
-d TEST -i TEST1
[root@node1 ~]# srvctl start instance -d TEST -i TEST1
[root@node1 ~]# srvctl status instance -d TEST -i TEST1
Check Database And ASM Instance
[root@node1 ~]# ps -ef | grep pmon |
grep -v grep
grid 9522 1 0 Aug 10 ? 00:00:03 asm_pmon_+ASM1
oracle 12756 1 0 08:00 ? 00:00:00 ora_pmon_TEST1
[root@node1 ~]#
Tuesday, July 25, 2023
STEP BY STEP MANUAL DATABASE CREATION IN LINUX ORACLE 11G
STEP BY STEP MANUAL DATABASE CREATION IN LINUX ORACLE 11G
Create the database manually, using
CREATE DATABASE statement. Sometimes as a DBA we are not able to use GUI to
create a database in this case, we should know syntax of database creation from
SQL*Plus.
Step By Step process to create
database manually:
Step 1:- Specify an Instance
export ORACLE_SID=test
export ORACLE_HOME=u01/app/oracle/product/11.2.0/dbhome_1/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
Step 2:- Create required
directories as per your location (I have created Database Directory :
/u01/app/oracle/oradata/test)
-pfile
-data
-control
-log
-back
-user
-trace
-archive
-flash_recovery_area
(Fast_Recovery_Area)
Step 3:- Create parameter file and modify it by setting minimum
required parameters: Save the file (/u01/app/oracle/oradata/test/pfile/inittest.ora)
db_name=’test’
memory_target=500m
processes = 150
audit_file_dest=’/u01/app/oracle/oradata/test/back’audit_trail=’db’
db_block_size=8192
db_domain=”’
db_recovery_file_dest=’/u01/app/oracle/oradata/test/flash_recovery_area’
db_recovery_file_dest_size=2G
diagnostic_dest=’/u01/app/oracle/oradata/test/trace’
dispatchers='(PROTOCOL=TCP) (SERVICE=test)’
open_cursors=300
remote_login_passwordfile=’EXCLUSIVE’
undo_tablespace=’UNDOTBS1′
# You may want to ensure that control
files are created on separate physical# devices
control_files =
(/u01/app/oracle/oradata/test/control/control1.ctl, /u01/app/oracle/oradata/test/control/control2.ctl)
compatible =’11.2.0′
Step 4:- Create the Password file
$ orapwd file=$ORACLE_HOME/dbs/orapwtest password=test entries=10
Step 5:- Create Server parameter file (SPFILE) using this
parameter file and STARTUP the instance in NOMOUNT mode.
$ sqlplus /nolog
SQL> CONNECT SYS AS SYSDBA
SQL> startup nomount
pfile=’/u01/app/oracle/oradata/test/pfile/initTEST.ora’;
OR (Use default location to start database with help of pfile. Depend where you
have created pfile. If path is not given it will look on DBS location
(Default))
SQL> startup nomount
pfile=’/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initTEST.ora’;
SQL> CREATE SPFILE FROM
PFILE=’/u01/app/oracle/oradata/test/pfile/initTEST.ora’;
Now our instance started, SGA
allocated and background processes started
Step 6: CREATE DATABASE (My Directory
Locatin:/u01/app/oracle/oradata/test/data)
CREATE DATABASE test
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
LOGFILE
GROUP 1 ‘/u01/app/oracle/oradata/test/log/redo1.log’ SIZE 10M,
GROUP 2 ‘/u01/app/oracle/oradata/test/log/redo2.log’ SIZE 10M,
GROUP 3 ‘/u01/app/oracle/oradata/test/log/redo3.log’ SIZE 10M
DATAFILE
‘/u01/app/oracle/oradata/test/data/system.dbf’ size 100M REUSE
sysaux datafile ‘/u01/app/oracle/oradata/test/data/sysaux.dbf’ size 100m
undo tablespace UNDOTBS1
datafile ‘/u01/app/oracle/oradata/test/data/undo1.dbf’ size 100m
DEFAULT TEMPORARY TABLESPACE temp1
TEMPFILE ‘/u01/app/oracle/oradata/test/data/temp01.dbf’
SIZE 100M REUSE
CHARACTER SET AL32UTF8
;
Step 7:- Run Scripts to Build Data
Dictionary Views
Run the scripts necessary to build
data dictionary views, synonyms, and PL/SQL packages, and to support proper
functioning of SQL*Plus:
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql
SQL> EXIT
Congratulation your database is
created successfully.
Interview Question.
What is the use of CATALOG.SQL scripts ?
CATALOG.SQL: Creates the views of the
data dictionary tables, the dynamic performance views, and public synonyms for
many of the views. Grants PUBLIC access to the synonyms.
What is the use of CATPROC.SQL ?
CATPROC.SQL: Runs all scripts required
for or used with PL/SQL.
What is the use of PUPBLD.SQL ?
PUPBLD.SQL Required for SQL*Plus.
Enables SQL*Plus to disable commands by user.
SQL> show parameter spfile;
NAME TYPE VALUE
———————————— ———– —————————————————————————————-
spfile string /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiletest.ora
SQL> select name from v$database;
NAME
————–
TEST
SQL> select name from
v$controlfile;
NAME
——————————————————————————–
/u01/app/oracle/oradata/test/control/control1.ctl
/u01/app/oracle/oradata/test/control/control2.ctl
SQL> select name from v$datafile;
NAME
——————————————————————————–
/u01/app/oracle/oradata/test/data/system.dbf
/u01/app/oracle/oradata/test/data/sysaux.dbf
/u01/app/oracle/oradata/test/data/undo1.dbf
SQL> select name from v$tempfile;
NAME
——————————————————————————–
/u01/app/oracle/oradata/test/data/temp01.dbf
SQL> select member from v$logfile;
MEMBER
——————————————————————————–
/u01/app/oracle/oradata/test/log/redo1.log
/u01/app/oracle/oradata/test/log/redo2.log
/u01/app/oracle/oradata/test/log/redo3.log
Thursday, July 13, 2023
Database full recovery and restore right upto the last online redolog transaction:
Database full recovery and restore right upto the last
online redolog transaction:
Verify which backup you have:
Rman target /
List backup;
Inr 0
Incr 1
Spool remove_database_files.sh
/
Spool off
Exit
Vi remove_database_files.sh
:wq
Sh ./remove_database_files.sh
At this point the database data files got completely deleted
from os level
How to restore and recover full database at this point:
List backup:
RMAN>restore database;
Here it will restore from incr 0
As you see it will restore from _c2kxcltc_bkp
Which has incr 0 backup
2.
RMAN>recover database;
Note: here recover database will recover from incr 1
See it includes incr 1
Finally
RMAN>Alter database open;
Exit
Sqlplus / as sysdba
Exit
To check trace log
Cd /home/oracle/diag/rdbms/orcl/trace
Vi ale*.log
You can see
Recovery of online redo log
Wednesday, July 5, 2023
How To Connect With RMAN in Oracle Database by Oracle OCE Mr.Ahmad
Learn different ways to connect with Recovery Manager (RMAN) in Oracle Database by Oracle OCE Mr.Ahmad.
------------------------------------------------------------------------
►►►LINKS◄◄◄
website: https://afgdba.blogspot.com/
Previous Tutorial :
• RMAN command to B...
ENTOPDBA YouTube:
/ @ucjnmklhj8p2b0qs... @entopdba501
Logical Standby in Oracle Data Guard Overview
In Oracle Data Guard , a Logical Standby Database is a standby database that: Receives redo data from the Primary database Convert...