Wednesday, March 2, 2022

Script to monitor RMAN progress

 Question:  I have a long running RMAN job, and I want a script to monitor the progress of RMAN execution.  How do you monitor RMAN progress?

Answer:  Oracle has several views that can monitor long running jobs, including v$session_longops and v$process with v$session.  Also see RMAN backup scripts from Windows DOS scripts for RMAN automated backups and example of RMAN shell script.

sselect
  sid,
  start_time,
  totalwork
  sofar,
 (sofar/totalwork) * 100 pct_done
from
   v$session_longops
where
   totalwork > sofar
AND
   opname NOT LIKE '%aggregate%'
AND
   opname like 'RMAN%';

select
   sid,
   spid,
   client_info,
   event,
   seconds_in_wait,
   p1, p2, p3
 from
   v$process p,
   v$session s
 where
   p.addr = s.paddr
 and
   client_info like 'rman channel=%';


Yousef Rifai has published this RMAN monitoring script, quite handy when you need to monitor the status of a long running RMAN backup job:

REM RMAN Progress
alter session set nls_date_format='dd/mm/yy hh24:mi:ss'
/
select SID, START_TIME,TOTALWORK, sofar, (sofar/totalwork) * 100 done,
sysdate + TIME_REMAINING/3600/24 end_at
from v$session_longops
where totalwork > sofar
AND opname NOT LIKE '%aggregate%'
AND opname like 'RMAN%'
/

REM RMAN wiats
set lines 120
column sid format 9999
column spid format 99999
column client_info format a25
column event format a30
column secs format 9999
SELECT SID, SPID, CLIENT_INFO, event, seconds_in_wait secs, p1, p2, p3
  FROM V$PROCESS p, V$SESSION s
  WHERE p.ADDR = s.PADDR
  and CLIENT_INFO like 'rman channel=%'
/

This script by Osama Mustafa will monitor the progress of a running RMAN job:

select
   to_char(start_time,'DD-MON-YY HH24:MI') "BACKUP STARTED",
   sofar,
   totalwork,
   elapsed_seconds/60 "ELAPSE (Min)",
   round(sofar/totalwork*100,2) "Complete%"
from
   sys.v_$session_longops
where  compnam = 'dbms_backup_restore';

Rename directory on ASM

 There are 2 type of Directories in ASM

1) Directories created by DBAC or RMAN are called as “System Directory” and they cannot be renamed.

2) Directories created Manually by issuing command “alter diskgroup add directory” or creating in ASMCMD console.

To check if the directory is system created or manually created check the view V$ASM_ALIAS column SYSTEM_CREATED, directories created by system will have the value as ‘Y’

To Rename “Manually” created directories

Login to the ASM console
[grid@tstdev01 ~]$ asmcmd
ASMCMD> cd DATA
ASMCMD> ls
ASM/
DEV/  — Here to rename DEV to TEST

SQL> ALTER DISKGROUP DATA RENAME DIRECTORY ‘+DATA/DEV’ to ‘+DATA/TEST’;
Diskgroup altered.

Once done longin to ASM console and verify the same
[grid@tstdev01 ~]$ asmcmd
ASMCMD> cd DATA
ASMCMD> ls
ASM/
TEST/



To Rename System Created directories

System created directory cannot be rename, use parameter db_unique_name of database. Oracle ASM and Oracle Diagnostic Dest create your own directory structure based on parameter DB_UNIQUE_NAME.

Move Database using RMAN

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name DEV

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
1 17408 SYSTEM YES +DATA/DEV/DATAFILE/system.259.941719615
2 1800 UNDOTBS1 YES +DATA/DEV/DATAFILE/undotbs1.267.941720063
3 4696 SYSAUX NO +DATA/DEV/DATAFILE/sysaux.258.941719569
4 1243 EXAMPLE NO +DATA/DEV/DATAFILE/example.266.941719731
5 118 USERS NO +DATA/DEV/DATAFILE/users.260.941719669

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
—- ——– ——————– ———– ——————–
2 1300 TEMP 1300 +DATA/DEV/TEMPFILE/temp.271.942061583

$sqlplus sys as sysdba
SQL> show parameter db_unique_name
NAME TYPE VALUE
———————————— ———– ——————————
db_unique_name string DEV


SQL> show parameter control_files

NAME TYPE VALUE
———————————— ———– ——————————
control_files string +DATA/DEV/CONTROLFILE/current.262.941719717

SQL> Alter system set DB_UNIQUE_NAME=’TEST’ scope=spfile;

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup nomount
SQL> show parameter db_unique_name

NAME TYPE VALUE
———————————— ———– ——————————
db_unique_name string TEST

$rman target /
RMAN> restore controlfile from ‘+DATA/DEV/CONTROLFILE/current.262.941719717’;
Starting restore at 10-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=162 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA/TEST/CONTROLFILE/current.263.981519213
Finished restore at 10-MAY-17

RMAN> startup mount;
database is already started
database mounted
released channel: ORA_DISK_1

RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3;
new RMAN configuration parameters:

RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3;
new RMAN configuration parameters are successfully stored

RMAN > CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

RMAN> BACKUP AS COPY DEVICE TYPE DISK DATABASE FORMAT ‘+DATA’;
Finished backup at 10-MAY-17

RMAN> SWITCH DATABASE TO COPY;
datafile 1 switched to datafile copy “+DATA/TEST/datafile/system.290.793638779

RMAN> run {
set newname for tablespace TEMP to ‘+DATA’ ;
switch tempfile all;
}

RMAN> report schema;
Report of database schema for database with db_unique_name TEST

List of Permanent Datafiles
==================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
1 17408 SYSTEM YES +DATA/TEST/datafile/system.290.793638779
2 1800 UNDOTBS1 YES +DATA/TEST/datafile/sysaux.291.793638757
3 4696 SYSAUX NO +DATA/TEST/datafile/undotbs1.292.793638823
4 1243 EXAMPLE NO +DATA/TEST/datafile/example.293.793638849
5 118 USERS NO +DATA/TEST/datafile/users.294.793638849

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
—- ——– ——————– ———– ——————–
1 1300 TEMP 1300 +DATA

RMAN> startup;
database is already started
database opened

Create the new redolog files and drop the old ones.

Once the above activity is completed backup the database.

RMAN> backup database;
Starting backup at 10-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=162 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=194 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=210 device type=DISK
.
.
Recovery Manager complete.

Now you can remove the copy:

RMAN> delete copy;

Advertisements

Oracle RMAN : Restore/ recover a database UNTIL TIME

 This tutorial explains you how to restore/ recover a database until a time.



Oracle RMAN : Restore/ recover a database UNTIL TIME


Here are the steps for Restoring/ Recovering an Oracle database until a specific time in the past:

 

1) Set the environment:

 

on Windows

set ORACLE_SID=DB10
echo %ORACLE_SID%
 

on AIX/Linux

export $ORACLE_SID=DB10

echo $ORACLE_SID

 

2) Connect to rman:

rman target / nocatalog
 

 

3) Start the database in "mount" state:

startup mount;
 

 

4) Run the following :
---------------------------------------
restore database UNTIL TIME
"to_date('11/03/2017 11:34:50 am','mm/dd/yyyy hh:mi:ss am')";

recover database UNTIL TIME
"to_date('11/03/2017 11:34:50 am','mm/dd/yyyy hh:mi:ss am')";

alter database open resetlogs;
---------------------------------------
OR

run
{
set UNTIL TIME "to_date('11/03/2017 11:34:50 am','mm/dd/yyyy hh:mi:ss am')";
restore database;
recover database;
alter database open resetlogs;
}

 

Note:

You have to put the right date/time.

CREATE PASSWORD FILE IN ASM DISK GROUP

 FOR ORACLE 12C ONLY

ASMCMD> pwcreate –dbuniquename {db_unique_name} {file_path} {sys_password}

ASMCMD> pwcreate –dbuniquename PRDPRE +DATA/PWDFILE/pwdPRDPREoracle

FOR ALL VERSION

orapwd file=’+DATA/orapwPRODPRE’ ENTRIES=10 DBUNIQUENAME=’PRODPRE’



https://docs.oracle.com/database/121/OSTMG/GUID-2ACBBB1E-A39D-473E-A9EF-E7BC3872C36E.htm

Tuesday, March 1, 2022

WHAT IS NFT AND HOW TO EARN WITH IT?

 

If you are interested in NFTs, this is how you earn it

NFTs are virtual goods used in gaming. They are often digital representations of objects that can be sold, traded or even rented. Examples include skins for weapons in the game Counter-Strike: Global Offensive, or Warframe platinum currency that can be bought with real money and used to purchase items in the game.

The first thing we should know about NFT is that it stands for Non-Fungible Token. In today’s digital world, these tokens can be treated as a form of property because they have a string value and cannot be divided into smaller quantities.

Non-Fungible Tokens are the new “genie” in the Crypto world. They are decentralized, fungible tokens that can digitally represent an asset or idea. These tokens are non-physical and cannot be duplicated.

When talking about how to earn money with this technology, there are multiple ways. We’ll discuss some of them later in the article along with answering the following questions:

  • What can I do with an NFT?
  • Can you make money with NFT?
  • What is NFT digital art?


 

How do Non-Fungible Tokens work?

Non-Fungible Tokens are unique digital assets that are accompanied by a certificate. The Certificate of Authenticity for the asset states that it is unique and different from any other token.

Ownership of the token is recorded through blockchain technology. These tokens could be digital representations of physical assets, such as artwork or clothing. As long as you are the owner, you can earn passive income with NFTs by imposing terms.

 

How to create NFTs & earn money?

The question of how to create non-fungible tokens and earn money has been on the minds of entrepreneurs, developers, and enthusiasts for quite some time. Non-fungible tokens are tokens that are unique in terms of their characteristics.

The following are the steps a person needs to follow to make NFT.

  • First, clarify and figure out what a non-fungible token is, and you are sure to make one and sell it.
  • Check out the platforms and select one that you want to sell.
  • Next, set up and connect the crypto wallet.
  • Finally, start creating your first non-fungible token and list it on your chosen platform.

After listing the digital assets, there are multiple ways of making a lifetime passive money. Some of them are the following.

 

Sell Non-Fungible Token on a Marketplace:

One of the most popular ways for people to make money is by selling their NFTs on a marketplace. There are a variety of platforms and marketplaces where these NFTs can be sold and traded on, such as:

  • OpenSea
  • Axie Marketplace
  • CryptoPunks
  • Rarible
  • SuperRare
  • Mintable

and so on.

 

Rent out:

Non-fungible tokens (NFTs) are digital assets that cannot be replicated. One way to use NFTs is through what is known as “renting”. Renting an NFT means giving it away for a fixed period of time in return for money.

 

Royalties:

The digital asset creator can earn passive lifetime royalties even after selling it out to someone else. The creator needs to impose terms and then, whenever someone buys the asset you initially created, you will still get royalties over your lifetime.

There are many other ways as well and people need to research more and more if they are interested. As we are talking about earning money online, we believe it is crucial to discuss how to make your digital wallet and online transactions safe, unblock content, and browse anonymously. The answer to all these questions is only “VPN.”

Virtual Private Networks are online security systems that use encryption algorithms to protect private information while it is being transmitted. A VPN creates a secure “tunnel” over the public Internet, which can then be used to safely transmit sensitive data.

Every VPN has its own encryption algorithm, although 256-bit encryption is typically the most common type it can also help you access unblocked site safely and quickly. We recommend people use VeePN while making online transactions or just browsing the internet.


 

NFT Sports:

Non-fungible tokens are offering great opportunities to every field, including sports. Unfortunately, no one has fully benefited from them yet. These digital assets can be a great money-making opportunity for sports like football and tennis game, if applied correctly.

They can also be helpful in increasing fan engagement with their favorite sports. Sports lovers always love to get sports collectibles like a badge, t-shirts, etc. and non-fungible tokens provide exactly that opportunity, but in digital form.

Non-fungible tokens in sports can’t only be restricted to t-shirts, badges, but they can also be fans’ favorite moments, photos, historical videos, and so on. In short, anything can be converted to a digital asset.

The sports industry, like the gaming industry, needs to adopt this technology as soon as possible and grow their market, standard, and new way of fan engagement easily.

 

Popular & Expensive Non-Fungible Tokens:

There is a huge list of the most popular and expensive non-fungible tokens. Some of them are already sold for nearly $100 million and even more. Here we are going to briefly discuss 5 popular tokens.

 

The Merge:

The Merge by digital artist Pak is one of the most expensive and popular non-fungible tokens. The Merge is a mysterious and creative artwork and was sold for $91.8 million

 

The First 5000 Days:

The First 5000 Days is an artwork created by the famous Beeple and sold for 69 Million Dollars in a first-ever digital art auction.

 

Human One:

Human One is a hybrid artwork, meaning it also combines some physical elements. The Human One was also created by Beeple and is worth nearly $29M.

 

CryptoPunk #7523:

CryptoPunk #7523 is a digital avatar that was bought by DraftKings’ Shareholder Shalom Mackenzie for nearly $12M.

 

CryptoPunk #3100:

CryptoPunk #3100 is another alien-based digital artwork with a blue and white headband. It sold for about $7.5 million.

In conclusion, NFT is a great way to passively make money. The process may appear daunting at first, but it’s relatively easy if you have some basic knowledge of how to operate on the blockchain.

Insert a new line at the beginning of a file

 Here's a way to add a line to the beginning of a file:


sed -i '1s!^!set timing on\n set time on\n set echo on\n!' batch1.sql_bkp

find . -type f -name '*.sql' -exec sed -i '1s!^!set timing on\n set time on\n set echo on\n!' {} \;


sed -i '1s/^/line_to_be_added\n/' file

Then, you could use the code above with find to achieve your ultimate goal:

find . -type f -name '*.js' -exec sed -i '1s/^/line_to_be_added\n/' {} \;

Wednesday, February 23, 2022

Commvault restore issue troubleshooting

 


Development is suggesting you to apply fix of Bug 33304775 - IPCDAT Errors - IBV Resources are Used for Processes Which Have No Need of Them ( Doc ID 33304775.8 )

There is no workaround, you will need to apply the fix. I'm checking for an available fix for you

Per Dev findings:
=============
The suspicion here is that RMAN is forking DB processes which are using a libcell context/IPCDAT context/QPs that are created by RMAN.

Due to a potential kernel issue, the child does not inherit the security context of the parent correctly (it does a deep copy as expected, but the ibverbs specific code is only doing a shallow comparison of the security context pointer).

If that happens, any ibv_modify_qp() call by the child will hit an EACCES for QPs created by RMAN.


The fix is to make sure that RMAN does not create QPs at all (it should not need to, since it does not do IOs with the cell directly). Bug 33304775 prevents processes from creating QPs unnecessarily, and could help with this issue.
=============
We had a couple of questions for you..
1. Is this issue reproducible 100% of the time when you try restoring this DB? if yes, how much time does it take from the time the restore is started..
2. Do you see the same issue across other DBs that you're migrating to 19c?
3. Are there any other DB or OS processes that are impacted during the same time ?

We can try and arrange a Zoom with rman development and Commvault support during US hours if this issue is easily reproducible. Also here is other information that Engg is requesting..

First, if the CommVault software changes uid or gid or any other process credential during runtime.

Second,
1. Copy the attached dtrace script trace.d to the node where they launch RMAM. The dtrace script will log a message for every attempt to change uid or gid.
2. Run “dtrace -s trace.d > /tmp/dtrace.out”.
3. Reproduce the issue.
a. While commVault/RMAN are running, capture the output of “cat /proc/<pid>/status” periodically, where <pid> is the pid of commVault and RMAN.
4. Once the issue is reproduced, collect the following:
a. The output of “dmesg -T”.
b. The ExaWatcher PS data from the period -- /opt/oracle.ExaWatcher/archive/Ps.ExaWatcher/
/c. var/log/audit/audit.log
d. /var/log/messages
e. /tmp/dtrace.out
f. The periodic dump of “cat /proc/<pid>/status” from Step 3a

Database Options/Management Packs Usage Reporting for Oracle Databases 11.2 and later (Doc ID 1317265.1)

  Database Options/Management Packs Usage Report You can determine whether an option is currently in use in a database by running options_pa...