Monday, September 24, 2018

Oracle Database Resource Management and Task Scheduling for B.C.A., B.Sc(IT) and all IT Studetns


--------------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah (HOD-IT)
E-Mail : rupareleducation@gmail.com
Contact No : 7600044051



Database Resource Management and Task Scheduling

Question: Automated database maintenance tasks

·        Oracle database has automated save common maintenance tasks typically performed by database administrators.

·        These automated maintenance tasks are performed when the system loaded is expected to be light.

·        You can enable and disable individual maintenance tasks, and can configure when these tasks run and what resource allocation they are allotted.

·        Automated maintenance tasks that are started automatically at regular intervals to perform maintenance operation on the database.

·        An example is a task that gathers statistics on schema objects for the query optimizer. Automated maintenance tasks run in maintenance windows, which are predefine time intervals that are intended to occurs  during a period of low system load.

·        You can optimize maintenance windows based on the resource usage pattern of your database and disable certain default windows from running.

You can also create your own maintenance windows.

Oracle database has three predefine automated maintenance tasks.
1.     Automatic optimizer statistics collection: Collects optimizer statistics for all schema objects in the database for which there are no statistics or only state statistics. The statistics gathered by this task are used by the SQL query optimizer to improve the performance of SQL execution.
2.     Automatic segment advisor: Identifies segments that have space available for reclamation and makes recommendations on how to defragment those  segments. You can also run the segment advisor manually to obtain more up-to-the-minute recommendations or to obtain recommendations on segments that the automatic segment advisor did  not examine for possible space reclamation.
3.     Automatic SQL tuning advisor: Examines the performance of high-load SQL statements, and makes recommendations on how to tune those statements. You can configure this advisor to automatically implement SQL profile recommendations.

Question: Managing resources with Oracle Database Resource Manger.

·        Oracle database resource manager enables you to manage multiple workloads within a database that are challenging for system and database resource.

·        When database resource allocation decisions are left to the operating system, you may encounter the following problems with workload management.

·        Exclusive overhead: Exclusive overhead results from operating system context switching between oracle database server process when the number of server processes is high.

·        Inefficient scheduling: The operating system reschedules database servers while they hold letches, while is inefficient.

·        Inappropriate allocation of resources: The operating system distributes resources equally among all active processes and cannot prioritize one task over another.

·        Inability to manage database-specific resources, such as parallel execution servers and active session.

Question: Oracle scheduler concepts
·        Oracle database includes oracle scheduler, an enterprise job scheduler to help you simplify the scheduling of hundreds or even thousands of tasks.

·        Oracle scheduler (the scheduler) is implemented by the procedure and function in the Oracle.

·        The scheduler enables you to control when and where various computing tasks take place in the enterprise environment.

·        The scheduler helps you effectively mange and plan these tasks. By ensuring that many routine computing tasks occur without manual intervention, you can lower operating costs, implement more reliable routines, minimize human error, and shorten the time window needed.

·        The scheduler provides sophisticated, flexible enterprise scheduling functionality, which you can use to run data base program units for external executables that are external to the database     

Schedule job execution using the following methods.
·        Time based scheduling: You can schedule a job to run at a particular date and time, either once or on a repeating basis.
·        Event-based scheduling: You can start a job in response to system or business events.
·        Dependency scheduling: You can set the scheduler to run tasks based on the outcome of one or more previous tasks.
                   Prioritize jobs based on business requirements
                   Controlling resource by job class
                   Controlling job prioritization based on schedules
                   Manage and monitor jobs
                   Execute and mange jobs in a clustered environment

Question: Scheduling Jobs with oracle scheduler
·        You operate oracle scheduler by creating and managing a set of scheduler objects.
·        Each scheduler object is a complete database schema object of the form schema.name.
·        Scheduler object follow the naming rules for database objects exactly and share the SQL namespace with other database objects.
·        Follows SQL naming rules to name scheduler objects in the DBMS SCHEDULER package.
o   By default, scheduler objects name are uppercase unless they are surround by double quotes for example, when creating a job, job_name, => ‘my_job’ is the same as job_name=> ‘My_JOB’ and ‘job_name’ => ‘MY_JOB’, but different from job_name => “my_job”.
o   This naming rules are also followed in those cases where comma-delimited lists of scheduler object names are used within the DBMS_SCHEDULER package.
o   You create one or more jobs using the DBMS SCHEDULER CREATE JOB or DBMS SCHEDULER.
o   CREATE_JOBS procedures or enterprise manager. You use the CREATE JOB procedure to create a single job.
o   This procedure is overloaded to enable you to create different types of jobs that are based on different objects.
o   You can create multiple jobs in single transaction using the CREATE JOBS procedure.

Question: Administering oracle scheduler
·        You must have the SCHEDULER_ADMIN role to perform all oracle scheduler administration tasks. Typically, database administration already have this role with the admin option as part of the DBA role. For example, users sys and SYSTEM  are granted the DBA role. You can grant this role to another administrator by issuing the following statement.

SQL> GRANT SCHEDULER_ADMIN TO user nam;

·        Because the SCHEDULER_ADMIN role is a powerful role allowing a grantee to execute code as any user, you should consider granting individual Scheduler system privileges are granted using regular SQL grant syntax. An example is if the database administrator issues the following statement.

SQL> GRANT CREATE JOB TO scott;

·        After this statement is executed, scott can create jobs, schedules, programs, file watchers and credentials in his schema. Another example is if the database administrator issues the following statement

SQL> GREANT MANGE SCHEDULER TO adam;

·        After this statement is executed, adam can create, alter, or drop windows, job classes, or window groups he will also be able to set and retrieve scheduler attributes and group purge scheduler logs.


:: Best Of Luck  ::

Please give your comment and share it.... 

Monday, September 17, 2018

Input Output Library Function in C Language for BCA, B.Sc(IT) and PGDCA Students


--------------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah (HOD-IT)
Contact No : 7600044051
E-Mail : rupareleducation@gmail.com




I/O Formatting Functions

Printf() function :
·        Printf() function is use to display something on the console or to display the value of some variable on the console The general syntax for printf() function is as follows
printf(<”format string”>,<list of variables>);
·        To print some message on the screen
·        Printf(“God is great”);
·        This will print message “God is great” on the screen or console.
·        To print the value of some variable on the screen
int a=10;
printf(“%d”,a);
Here %d is format string to print some integer value and a is the integer variable whose valuewill be printed by printf() function. This will print value of a “10” on the screen.
·        To print multiple variable’s value one can use printf() function in following way.
Int p=1000,r=10,n=5;
Printf(“amount=%d rate=%d year=%d”,p,r,n);
This will print “amount=1000 rate=10 year=5” on the screen

Scanf() Function :
·        Scanf() function is use to read data from keyboard and to store that data in the variables. The general syntax for scanf() function is as follows.
Scanf(“Format String”,&variable);
·        Here format string is used to define which type of data it is taking as input this format string can be %c for character, %d  for integer variable and %f  for float variable.
·        Where as variable the name of memory location or name of the variable and & sign is an operator that tells the compiler the address of the variable where we want to store the value.
·        One can take multiple input of variable with single scanf() function but it is recommended that there should be one variable input with one scanf() function.

Single character input – the getchar( ) function :
·        Single characters can be entered into the computer using the “C” library function getchar. The getchar function is a part of the standard “C” language I/O library.
·        It returns a single character from a standard input device (typically a keyboard).
·        The function does not required any arguments through a pair of empty parentheses must follow the word getchar.
·        In general terms, a reference to the getchar function is written as.

Character variable=getchar();

·        Where character variable refers to some previously declared character variable.

Single character output – The putchar( ) function:

·        Single character can be displaye using the C library function putchar.
·        The putchar function, like getchar is a part of the standard “C” language I/O library.
·        It transmits a single character to a standard output device.
·        The character being transmitted will normally be represented as a character-type variable.
·        It must be expressed as an  argument to the function, enclosed in parentheses following the word putchar.
·        In general a reference to the  putchar function is written as
Putchar (character variable)

Where character variable refers to some previously declared character

getc() Function

The C library function int getc(FILE *stream) gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.
Following is the declaration for getc() function.
int getc(FILE *stream)
stream is the pointer to a FILE object that identifies the stream on which the operation is to be performed. This function returns the character read as an unsigned char cast to an int or EOF on end of file or error.

putc () Function :

The C library function int putc(int char, FILE *stream) writes a character (an unsigned char) specified by the argument char to the specified stream and advances the position indicator for the stream.
Following is the declaration for putc() function.
int putc(int char, FILE *stream)
char  is the character to be written. The character is passed as its int promotion. stream  is the pointer to a FILE object that identifies the stream where the character is to be written. This function returns the character written as an unsigned char cast to an int or EOF on error.

gets() Function

The C library function char *gets(char *str) reads a line from stdin and stores it into the string pointed to by str. It stops when either the newline character is read or when the end-of-file is reached, whichever comes first.
Following is the declaration for gets() function.
char *gets(char *str)
str  is the pointer to an array of chars where the C string is stored. This function returns str on success, and NULL on error or when end of file occurs, while no characters have been read.

puts() Function

The C library function int puts(const char *str) writes a string to std out up to but not including the null character. A newline character is appended to the output.
Following is the declaration for puts() function.
int puts(const char *str)
str  is the C string to be written. If successful, non-negative value is returned. On error, the function returns EOF.

 

getchar () Function
The C library function int getchar(void) gets a character (an unsigned char) from stdin. This is equivalent to getc with stdin as its argument.
Following is the declaration for getchar() function.
int getchar(void)
This function returns the character read as an unsigned char cast to an int or EOF on end of file or error. The int getchar(void) function reads the next available character from the screen and returns it as an integer. This function reads only single character at a time. You can use this method in the loop in case you want to read more than one character from the screen.

 

putchar () function
The C library function int putchar(int char) writes a character (an unsigned char) specified by the argument char to std out.
Following is the declaration for putchar() function.
int putchar(int char)
char  is the character to be written. This is passed as its int promotion.
This function returns the character written as an unsigned char cast to an int or EOF on error. The int putchar(int c) function puts the passed character on the screen and returns the same character. This function puts only single character at a time. You can use this method in the loop in case you want to display more than one character on the screen.

Ungetc() function

The C library function int ungetc(int char, FILE *stream) pushes the character char (an unsigned char) onto the specified stream so that the this is available for the next read operation.
Following is the declaration for ungetc() function.
int ungetc(int char, FILE *stream)
char  is the character to be put back. This is passed as its int promotion. stream  is the pointer to a FILE object that identifies an input stream. If successful, it returns the character that was pushed back otherwise, EOF is returned and the stream remains unchanged.

Best Of Luck 

Please Share and give your valuable comment.... 

Wednesday, September 5, 2018

Math Library Function in C - Language for BCA Sem - 1 and PGDCA Sem - 1 Students



---------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah (HOD - IT)
Contact No : 7600044051
E-Mail : rupareleducation@gmail.com


MATH LIBRARY FUNCTION

SQRT

Calculates square root of Given number

Declaration:
double sqrt(double x);
Remarks:
sqrt calculates the positive square root of the input value.

Sin
Declaration:
          double sin(double x);
Remarks:
Sin compute the sine of the input value, Angles are specified in radians.

Cos
Declaration:
          double cos(double x);
Remarks:
Cos compute the cosine of the input value, Angles are specified in radians.

Tan
Declaration:
          double tan(double x);
Remarks:
Tan calculate the tangent of the input value, Angles are specified in radians.



Power
Power function, x to the y (x**y)
Declaration:
double pow(double x, double y);
Remarks:
pow and powl calculate x**y.

modf
modf splits double into integer and fraction parts
Declaration:
double modf(double x, double *ipart);
Remarks:
modf breaks the double x into two parts: the integer and the fraction. It stores the integer in ipart and returns the fraction.

Log
log  =  natural logarithm function
log10 = common logarithm function

 Declaration:
double log(double x);
double log10(double x);      

Remarks:
log calculate the natural logarithm of x.
log10 calculate the base 10 logarithm of x.


FMOD
          Fmod function is used for floating pointing modularizing
 Declaration:
double fmod(double x, double y);
Remarks:
fmod calculate x modulo y. This is defined as the remainder




Ceil
ceil is used for  round up the value

Declaration:
double ceil(double x);

Remarks:
ceil finds the smallest integer not < x.

Floor
floor is used for  round down the value
Declaration:
double floor(double x);
Remarks:
floor finds the largest integer not > x.

Abs
abs (a macro) gets the absolute value of an integer
Declaration:
int abs(int x);       
Remarks:
All of these routines return the absolute value of their argument.

Fabs
fabs and fabsl calculate the absolute value of a floating-point number
Declaration:
          double fabs(double x);
Remarks:
All of these routines return the absolute value of their argument.

Exp
Real exp calculates e to the xth power
Declaration:
          double exp(double x);
 Remarks:
exp calculates the exponential function e of  X where Value of e is 2.718282

Div
div divides two integers
Declaration:
          div_t  div(int numer, int denom);
Remarks:
div divides two integers and returns both the quotient and the remainder as a div_t type.


ACOS , ASIN , ATAN

Arc cosine, arc sine, and arc tangent functions
Declaration:
double acos(double x);
double asin(double x);
double atan(double x);
Remarks:
acos  is compute the arc cosine of that value
asin is compute the arc sine of that value
atan is calculate the arc tangent of the input value

String Library Function in C Language for BCA Sem - 1 and PGDCA Sem - 1


---------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah (HOD-IT)
Contact No : 7600044051
E-Mail : rupareleducation@gmail.com


String Library Function

Strcpy
Copies all most characters of src to dest

Declaration:
     char *strcpy(char *dest, const char *src);

Remarks:
     Copies string src to dest, stopping after the terminating null character has been moved.


strncpy
Copies at most max length characters of src to dest

Declaration:
     char *strncpy(char *dest, const char *src, size_t maxlen);
    
Remarks:
     strncpy copies up to maxlen characters from src into dest,      truncating or null-padding dest. _fstrncpy is the far version.

     The target string, dest, might not be null-terminated if the length of src
     is maxlen or more.


strcat
Appends one string to another

Declaration:
char *strncat(char *dest, const char *src, size_t maxlen);

Remarks:
     strncat copies at most maxlen characters of src to the end of dest and      then appends a null character.



strchr
Scans a string for the first occurence of a given character

Declaration:
char *strchr(const char *s, int c);

Remarks:
strchr scans a string in the forward direction, looking for a specific character.

strrchr
Finds the last occurrence of c in s

Declaration:
char *strrchr(const char *s, int c);

Remarks:
strrchr scans a string in the reverse direction, looking for a specific character.

strcmp
strcmp compare two strings
int strcmp(const char *s1, const char*s2);

Remarks:
The string comparison starts with the first character in each string and continues with subsequent characters until the corresponding characters differ or until the end of the strings is reached.

To use strcmp, you must include STRING.H. This macro is provided for compatibility with other C compilers.

strncmp
strncmp compare portions of two strings. strncmpi is a macro compares portions of two strings, without case sensitivity

Declaration:
int strncmp (const char *s1, const char *s2, size_t maxlen);



Remarks:
Each of these routines compares s1 to s2, looking at no more than maxlen characters.


The string comparison starts with the first character in each string and continues with subsequent characters until the corresponding characters differ or until maxlen characters have been examined.

To use strncmp, you must include STRING.H.




strcspn
strcspn scan a string for a segment that DOES NOT contain a subset of a set of characters. strspn scan a string for a segment that is a subset of a set of characters

Declaration:
size_t strcspn(const char *s1, const char *s2);

Remarks:

strcspn find the initial segment of string s1 that consists entirely of characters NOT from string s2.

Strlen
Calculates length of a string

Declaration:
size_t strlen(const char *s);
    
Remarks:
strlen calculates the length of s.

Return Value:
Returns the number of characters in s, not counting the terminating null





strpbrk
Scans one string for the first occurrence of any character that is in a second string

Declaration:
char *strpbrk(const char *s1, const char *s2);

Remarks:
strpbrk scans a string, s1, for the first occurrence of any character appearing in s2.





strstr
Finds the first occurrence of a substring in another string

Declaration:
char *strstr(const char *s1, const char *s2);

Remarks:
strstr scan s1 for the first occurrence of the substring s2.On success, strstr returns a pointer to the element in s1

strtok
Scans s1 for the first token not contained in s2

Declaration:
char *strtok(char *s1, const char *s2);

Remarks:
strtok consider the string s1 to consist of a sequence of zero or more text tokens, separated by spans of one or more characters from the separator string s2.

The first call to strtok
*  returns a pointer to the first character of the first token in s1, and
*  writes a null character into s1 immediately following the returned token.


Best Of Luck