DronaBlog

Monday, December 10, 2018

Issues noticed during Materialized View Creation - ORA-23413: table "CMX_ORS"."C_B_CUST" does not have a materialized view log



Did you encounter with ORA-23413 the Oracle database error while creating a Materialized view? Are you also noticing ORA-01031: insufficient privileges error? If yes, then refer below article about explanation and solution to these database errors?

SQL Error: ORA-23413: table "CMX_ORS"."C_B_CUST" does not have a materialized view log

Explanation: This type of error occurs if you try to create a Materialized view on table C_BO_CUST without creating the Materialized View Log. It is mandatory to create log definition first before creating actual Materialized View.

Error Message:
SQL Error: ORA-23413: table "CMX_ORS"."C_B_CUST" does not have a materialized view log
23413. 00000 -  "table \"%s\".\"%s\" does not have a materialized view log"
*Cause:    The fast refresh cannot be performed because the master table does not contain a materialized view log.

Solution: Use the sample below to create the Materialized View Log -
CREATE MATERIALIZED VIEW LOG ON C_B_CUST
   PCTFREE 5
   TABLESPACE CMX_TEMP
   STORAGE (INITIAL 5K NEXT 5K);



SQL Error: ORA-01031: insufficient privileges

Explanation: ORA-01031 - insufficient privileges is the generic message which normally occurs if required privileges are not available for given operation. In the case of Materialized view, if user does not have "CREATE MATERIALIZED VIEW" privileges then 'ORA-01031: insufficient privileges'  error message will be reported.

Error Message:
SQL Error: ORA-01031: insufficient privileges 01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to change the current username or password 
           without the appropriate privilege. This error also occurs if
           attempting to install a database without the necessary operating
           system privileges.
           When Trusted Oracle is configure in DBMS MAC, this error may occur
           if the user was granted the necessary privilege at a higher label
           than the current login.

Solution: In order to get required privileges we need to reach out Oracle DBA. In the current case, we need to ask DBA to provide "CREATE MATERIALIZED VIEW" privileges to given user. Assume that you are using TEST_USER to create Materialized view then ask DBA to provide privileges below -
GRANT CREATE MATERIALIZED VIEW TO TEST_USER

The video below provides a detailed explanation and prerequisites for Material views : 




Friday, December 7, 2018

Important Python Interview Questions and Answers - Part III

Are you preparing for Python interview and looking for questions and answers? Would you also like learn Python concepts? If so, then read this article to prepare for your interview. If you have not read the previous article  then you can read here Important Python Interview Questions and Answers - Part II


Q 1: What is the use of PYTHONPATH environment variable in Python language?

Answer
  • The environment variables PATH and PYTHONPATH are similar. 
  • The variable PYTHONPATH provides information to Python interpreter in order to locate the module files or source code files which are imported in the source code.
  • Normally, PYTHONPATH includes source library directory and the directories which contain source code. 
  • The Python installer normally setup PYTHONPATH variable automatically. If it is not set then we have to manually set it.

Q 2: Explain the purpose of PYTHONCASEOK and PYTHONSTARTUP environment variable in Python?

Answer: The environment variables such as PYTHONCASEOK and PYTHONSTARTUP are important for Python programming and execution as like PYTHONPATH variable. 
  • PYTHONSTARTUP:
  1. This variable contains path of an initialization file containing Python source code.
  2. When we start the Python interpreter, initialization is executed each time.
  3. In the Unix system, it is named as pythonrc.py
  4. The commands are included to load utilities or change PYTHONPATH  
  • PYTHONCASEOK:
  1. It is used in the Windows operating system.
  2. It is used to find the first case-insensitive match in the import statement.
  3. To activate this variable, we can set it to any value.
  • PYTHONHOME:
  1. It is normally used within PYTHONSTARTUP or PYTHONPATH directories.
  2. It is used to make easines in switching module libraries. 


Q 3: How to convert a String value to an integer, a long and a float value in Python?

Answer: Converting String to other data types such as integer, long and float is common practice in Python programming. It is required for the various reason such as to perform arithmetic operations.
1. String to Int -
Use int function to convert the String value to an integer.
Syntax: Here, base specifies the base if x is a string.
int(x [,base])  
Example:
x = "5"
int_value = int(x) 
2. String to long -
Use long function to convert the String value to the long value.
Syntax: Here, base specifies the base if x is a string.
long(x [,base])  
Example:
x = "50000"
long_value = long(x) 
3. String to Float -
Use float function to convert the String value to the float value.
Syntax: Here, base specifies the base if x is a string.
float(x)  
Example:
x = "8.5"
float_value = float(x)

Q 4: What is the use of ** operator Python language?

Answer:  
  • It is an arithmetic operation. 
  • It is known as the Exponent operator.
  • It is used to perform an exponential i.e. Power calculation
e.g.  a = 4  and b = 5
       a **  b =  1024




Q 5: What is the use of // operator in Python language?

Answer:

  • The operator // is called floor division
  • It is the division of operands where the result is the quotient in which the digits after the decimal point are removed.








            



Wednesday, December 5, 2018

Important Python Interview Questions and Answers - Part II



In this article, we will see details on the most important questions which are asked during Python interviews. In the Python interview question and answers part - , we learned some basic questions. In this article, we learn more interesting questions and their answers in order to prepare for the Python interview. Good luck with your interview.



Q 1: What are the differences between List and Tuples?

Answer: The mentioned below is list differences between List and Tuples

List
Tuples
List elements can be changed as they are mutable
Tuples elements cannot be modified as they are immutable.
Normally, lists are slower compared to tuples during execution
Normally, tuples are faster than lists during execution of the program.
The list is created using open and close rectangular brackets
Tuples are created using open and close simple brackets
e.g. country_list = [“US”, “INDIA”, “UK”]
e.g. region_tuple = (“NA”, “APAC”, “LA”)


Q 2: Explain Multithreading concepts in Python?

Answer: The multithreading in Python is explained as below
  1. In order to achieve multithreading i.e. executing the program in parallel, Python has a multi-threading package.
  2. The concept named the Global Interpreter Lock (GIL) is used in Python.  It is the responsibility of GIL to make sure that only one ‘threads’ can execute at any a time. 
  3. The thread acquires GIL for processing business logic. Once processing is completed, it passes the GIL onto the next thread.
  4. This processing happens very quickly so to the human eye. On the surface, it looks like threads are running in parallel, but they are really just taking turns using the same CPU core.
  5. The extra overhead of working with GIL will cause extra processing time.



Q 3: What are the rules or standards for global and local variables in the Python language?

Answer:  The basic guidelines for local and global variables are as below
Global variables: The variables which are only referenced inside a function are implicitly global.

Local variables: The local variables are those variables for which a new value is assigned within the function's body.

Q 4: What are the supported data types in Python?

Answer: The supported data types in Python are 
  1. Number
  2. String
  3. List
  4. Tuple
  5. Dictionary
Here, the Number data type can include integer and float values.

You can refer the video below to learn more about Python programming -

Q 5: Is it possible to convert Integer value to String value and vice-versa in the Python language?

Answer: Yes, we can convert an integer value into the String value. Also, we can convert the String value to integer value.  

Normally, if we get input from the user is comes as String even it is number. So in such cases, we need to convert the String value to an integer value  as

    user_input = input("Enter any number")
    int_value = int(user_input)
    print(int_value * 5)

In some cases, we need to convert the numeric value to String value. e.g. Printing number value with appending string content.

       int_age_value = 25
   print("Age of a person is " + str(int_age_value))





                                        


Tuesday, December 4, 2018

Important Python Interview Questions and Answers - Part I


In this article, we will focus on the most important questions which are asked during Python interviews. If you preparing for Python interview then this article will be the good start. If any detailed explanation is required then respective links are provided for your knowledge. Good luck with your interview.



Q1. What are the differences between Python version 3 and Python Version 2?

Answer: Both the Python versions are important for Python programming and they come with their own significance. We will discuss here the differences between these two Python versions.

S. No
Python Version 3
Python Version 2
1.
Python version 3 supports -Unicode UTF-8 and it has two-byte classes –a) Byte b)ByteArray
Python version 2 supports - ASCII str() types and separate Unicode() but there is no byte type code
2.
To print, any string parentheses are required in Python version 3. It will raise error without parentheses.
In Python version 2, to print any string no parentheses are required
3.
If we try to compare un-orderable types then it raises ‘TypeError’ as the warning
Python version 2 silently ignore the error/warning we try to compare un-orderable types
4.
The SyntaxError will be reported when we don’t enclose the exception argument in parentheses.
In this version, it accepts both new and old notations of syntax.



You can refer the video tutorial on Python to better understand Python concepts -


Q 2: What is the memory management process in Python?

Answer: The memory management in Python is similar to other programming languages such as Java.
  • The allocation of heap space is done by the memory manager. It includes memory allocation for Python objects and data structures.
  • The private heap space is used in Python for memory management. The data structures and Python objects are located in this private heap memory. 
  • The Python interpreter interacts with memory and takes care of memory-related tasks.
  • The garbage collector is used to release memory of unused object and make memory available to the heap space. The garbage collector is the inbuilt feature, no special configuration is not required.

Q 3: How Python is interpreted?

Answer: 
  • Python language is an interpreted language. 
  • The program written by the developer is interpreted by Python interpreter. 
  • Once the source is interpreted, it is executed step by step. 
  • The Python program runs directly from the source code, unlike Java compiler where the complete file is compiled first and then it is executed.
In the figure below, HelloWorld.py a Python file is interpreted by Python interpreter and executed at runtime. The output is shown on the console.

Q 4: What is namespace in Python language?

Answer: 
  • The namespace in Python defines the scope for objects such as package, module, class, function.
  • Each module, package, class, and function owns a namespace. In this namespace, variable names are resolved.
  • The namespace is evaluated during execution and dropped after execution is completed.
  • The global namespace is used if the local namespace is not defined.
  • The variable name is checked in the local namespace i.e. in the body of the function or the module, etc. If the variable name is not found in a local namespace then it is checked in the global namespace.
  • The variables are generally created in a local namespace. 



Q 5: What are the module and the package in Python language?

Answer: 
a) Module: The module is the way to structure program. The module can contain one more many Python program file or files. The module can import other modules like the attributes and the objects.

b) Package:  The package is the folder in Python language. A package can have modules or subfolders.








Thursday, November 29, 2018

Very Important Unix Commands


Are you looking for an article for Unix commands which are used for daily activities? Are you looking for the Unix commands which are used for manipulating data? Are also willing to know what commands used for networking and compressing the files? If yes, then you can refer this article as it highlights on commands which are used for data manipulation, networking, messaging and compressing the files.

A) Commands used for manipulating data:


Command
Details
awk
Pattern scanning and processing language
cmp
Compares the contents of two files
comm
Compares sorted data
cut
Cuts out selected fields of each line of a file
diff
Differential file comparator
expand
Expands tabs to spaces
join
Joins files on some common field
perl
Data manipulation language
sed
Stream text editor
sort
Sorts file data
split
Splits the file into smaller files
tr
Translates characters
uniq
Reports repeated lines in a file
wc
Counts words, lines, and characters
vi
Opens vi text editor
vim
Opens vim text editor
fmt
Simple text formatting
spell
Checks text for spelling error
ispell
Checks text for spelling error
emacs
GNU project Emacs
ex, edit
Line editor


B)  Commands used for Compressing files:


Command
Details
compress
Compresses files
gunzip
Helps uncompress gzipped files
gzip
GNU alternative compression method
uncompress
Helps uncompress files
unzip
List, test, and extract compressed files in a ZIP archive
zcat
Cat a compressed file
zcmp
Compares compressed files
zdiff
Compares compressed files
zmore
File perusal filter for crt viewing of compressed text




C)  Commands used for Getting information:


Command
Details
apropos
Locates commands by keyword lookup
info
Displays command information pages online
man
Displays manual pages online
whatis
Searches the whatis database for complete words
yelp
GNOME help viewer


D)  Commands used for Network Communication:


Command
Details
ftp
File transfer program
rcp
Remote file copy
rlogin
Remote login to a Unix host
rsh
Remote shell
tftp
Trivial file transfer program
telnet
Makes terminal connection to another host
ssh
Secures shell terminal or command connection
scp
Secures shell remote file copy
sftp
Secures shell file transfer program




E)  Commands used for sending messages between users:


Command
Details
evolution
GUI mail handling tool on Linux
mail
Simple send or read mail program
mesg
Permits or denies messages
parcel
Sends files to another user
pine
Vdu-based mail utility
talk
Talks to another user
write
Writes message to another user




Refer the video below more interesting concepts about Unix technology -


What is CRM system?

  In the digital age, where customer-centricity reigns supreme, businesses are increasingly turning to advanced technologies to manage and n...