|Skip Navigation Links|
|Exit Print View|
|System Administration Guide: Naming and Directory Services (NIS+)|
To add new entries (rows) to a table, use nistbladm with either the -a or -A options followed by either one or more column=value pairs and the table name or an indexed name as described in nistbladm and Indexed NIS+ Names.
nistbladm [-a | -A] indexedname nistbladm [-a | -A] column="value" \ column="value" \ ... tablename
When adding new entry rows to a table with either -a or -A:
Always enclose the value element in quotes. For example, to add an entry where the value of the cname column is deneb, the column=value pair would look like: cname="deneb".
You must specify a value for every column in the table.
To specify that a column in the entry row you are adding is empty use column=" ". In other words, for the value, enclose a space between the quote marks.
Note - NIS+ is a naming service and its tables are designed to store references to objects, not the objects themselves. NIS+ is optimized to support 10,000 objects with a combined total size of all tables not more than 10M bytes. NIS+ does not support individual tables where the sum of field sizes in a single column are greater than approximately 7k. If a table is too large, rpc.nisd may fail.
The -a option adds an entry to a table unless the entry already exists, in which case it returns an error. An entry is defined as existing if its values in the searchable columns exactly match the values in the new entry's searchable columns. (The values in non-searchable columns are not taken into account.)
To use the -a option, you must specify a value for every column in the table:
nistbladm -a column="value" \ column="value" \ ... tablename nistbladm -a indexedname
For example, to add a new row to a table named depts using column=value pairs, you would enter:
rootmaster% nistbladm -a Name='R&D' Site='SanFran' \ Name='vattel' depts.doc.com.
To add the same entry using an indexed name, you would enter:
rootmaster% nistbladm -a [Name='R&D',Site='SanFran',\ Name='vattel'],depts.doc.com.
Both examples would produce a table row that looked like this:
C-shell users should also use quotes to set off expressions using square brackets.
If a table row already exists with values in each column that are identical to the entry you are trying to create, nistbladm -a will return an error. You cannot have two identical entry rows in a table. In this context, rows are considered identical if the values in the searchable columns are identical, the values in none search able columns are not considered.
For example, if the Dept and Site columns are searchable, and the Name column is not searchable, nistbladm considers the following two rows to be identical:
In this example, nistbladm -a would not allow you to create the Sales Vancouver Lincoln row.
However if just some of the searchable columns have values identical to the entry you are trying to create, nistbladm -a will create a new entry as specified. For example, you could run the following commands to create two similar, but not identical, rows in a depts table:
rootmaster% nistbladm -a Dept='Sales' \ Site='Vancouver' Name='hosteen' staff.doc.com. rootmaster% nistbladm -a Dept='Sales' \ Site='SanFran' Name='lincoln' staff.doc.com.
Which would produce rows that had some, but not all identical values in the searchable columns:
The -A option is designed for applications where you need to force nistbladm to overwrite an existing entry. Like the -a option, -A adds a new entry to a table. However, if the entry already exists, instead of exiting with an error, it overwrites the existing entry row.
When using the -A option, you must specify all columns in the entry.
For example, suppose the following table exists and the Dept and Site columns are searchable:
Now you run the following command:
rootmaster% nistbladm -A Name=Sales Site=SanFran \ Name=Tsosulu depts.doc.com.
The -a option would have returned an error, since the entry specified by Name=Sales Site=SanFran already exists. But the -A option allows you to overwrite the existing row.